@dynamic and Programmatic Access to Setters
@dynamic and Programmatic Access to Setters
- Subject: @dynamic and Programmatic Access to Setters
- From: Mike Rossetti <email@hidden>
- Date: Thu, 17 Apr 2008 21:15:58 -0600
I'm a bit confused by @dynamic and hoping there's a simple explanation.
My little project has a data model and a custom class (Tip) for one of
the classes in the model. The Tip interface defines the attributes,
one of which is:
@property (retain) NSString *tipName;
Tip's implementation has:
@dynamic tipName;
Everything works swell with bindings, the UI is fully functions, the
file saves -- happiness.
Then I add a class method that creates a new Tip and tries the
following assignment (two approaches shown):
newTip.tipName = @"FUBAR";
[newTip setTipName:@"FUBAR"];
Both cause a runtime error:
-[tip setTipName:]: unrecognized selector sent to instance
Bindings clearly work so I'm surprised the setTipName isn't
synthesized and available for my use.
Choosing the attribute in the model and the "Copy Obj-C 2.0 Method
Implementations to Clipboard" shows the following words:
* You do not need any of these.
* These are templates for writing custom functions that override the
default CoreData functionality.
* You should delete all the methods that you do not customize.
* Optimized versions will be provided dynamically by the framework.
I don't want to customize the default functionality, I just want to
access it.
Hint?
Thanks,
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden