Since you declared title
and text
as properties, but for some reason get the exception:
[Notez setTitle:]: unrecognized selector sent to instance, apparently
I can only make another guess here. Usually, when declaring a property, you get a setter
and a getter
method for it. This way you can omit writing these by hand if you have a lot of instance variables on a class.
Using dot notation
is then equivalent to calling the setter
or the getter
. So in your case
newNote.title = [NSString stringWithFormat:@"23"];
is equivalent to:
[newNote setTitle:[NSString stringWithFormat:@"23"]];
Now, the exception that you suggests that the setter
method: setTitle:
actually does not exist on your object. I’m not sure what the reason for this might be, but you could try to explicitly synthesize your properties.
Therefor, in your .m-file add the following lines of code:
@synthesize title;
@synthesize text;
Not sure if this will actually solve your issue, but I hope the explanation of properties
, getters
and setters
helps you to understand a little more what’s going on.
2
solved Can’t set cell title’s text