In CoreData Model I have an entity called TestEntity. This entity has a single attribute named 'deleted' which is of type boolean.
If I generate an automatic NSManagedObject subclass for this entity using Xcode, the generated class header looks like this:
@interface TestEntity : NSManagedObject
@property (nonatomic, retain) NSNumber * deleted;
@end
I understand why NSNumber is used for a boolean attribute. This hasn't changed from before. The problem is that it now shows me 2 warnings:
I don't want to use primitive types. Any ideas how to get rid of these warnings? This could be a bug with Xcode 6 beta 7 (iOS 8 beta 5) that I am using. Already filed a bug report since the automatically generated class using Xcode should not result in a compiler warning in any case.
You managed to use an attribute whose name clashes with existing methods of NSManagedObject.
Solution: Change the name of the attribute. Don't call it "deleted" but something else.
I went to the NSManagetObject header file and it seems like Apple is using it this way.
// state - methods can be used through KVC, for example for enabling/disabling widgets based on the state of the object
@property (nonatomic, getter=isInserted, readonly) BOOL inserted;
@property (nonatomic, getter=isUpdated, readonly) BOOL updated;
@property (nonatomic, getter=isDeleted, readonly) BOOL deleted;
Try just changing the attribute name of your entity and my guess is that it won't be a light weight Core Data migration case. Make sure to check this before submitting your code.
I don't know if Apple just did this but I wasn't getting a Warning in iOS 7. Let's hope that this is a signal from Apple letting us know that they are fixing all the Core Data issues :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With