I came across an odd quirk related to Core Data, a declared protocol, and possibly the LLVM 1.5 compiler. Here is the situation.
I have a Core Data model that, among other things, has two classes: IPContainer and IPEvent, with IPContainer being the parent of the IPEvent. Each object has its own class in the project created using mogenerator. mogenerator generates an additional subclass that simply contains declarations of modeled properties, so the class hierarchy is actually IPEvent> _IPEvent> IPContainer> _IPContainer> NSManagedObject. The IPContainer object has an attribute named "id", which is declared as @property(nonatomic, retain) NSNumber* id;in _IPContainer.h. _IPContainer.m has @dynamic id;in implementation to tell Core Data to generate accessories at runtime
I also have the IPGridViewGroup protocol declared in my project that defines several properties, one of which is the same id property. However, the setter is not needed for classes that implement this protocol, so the property in the protocol is declared as the @property(readonly) NSNumber* id;IPEvent class declares that it conforms to the IPGridViewGroup protocol.
This worked fine using the Clang / LLVM 1.0.x compiler (depending on the version of Xcode 3.2.2), but after switching to Xcode 3.2.3 and Clang / LLVM 1.5 a whole bunch of things changed. First, when compiling the IPEvent class, I get the following warning:
/Volumes/Ratbert/Users/bwebster/Projects/UberProject/iPhotoLibraryManager/IPGridViewGroup.h:19:31: warning: property 'id' requires method 'id' to be defined - use @synthesize, @dynamic or provide a method implementation
Then, when I actually run the program, this prints to the console:
Property 'id' is marked readonly on class 'IPEvent'. Cannot generate a setter method for it.
Following:
-[IPEvent setId:]: unrecognized selector sent to instance 0x200483900
IPEvent, :
/Volumes/Ratbert/Users/bwebster/Projects/UberProject/iPhotoLibraryManager/IPManagedObject/IPEvent.h:14:40: warning: property 'id' 'retain' attribute does not match the property inherited from 'IPGridViewGroup'
, , , , , , , , .
, , , :
- , , readonly, readwrite , ? , readwrite , .
- , - Core Data. , IPEvent id, , IPGridViewGroup. , , , , readwrite ( _IPContainer) , AFAIK .
- , , . , , , , .
:, , IPEvent, , -. , , , .
readonly ( ), readwrite, "warning: attribute" readonly "" longitude " " readwrite ", " _IPEvent "" ". , , .
, , , IPEvent getter , " ", .