Reputation: 25
I have this model
#import <Realm/Realm.h>
@interface RGGoal : RLMObject
@property NSString *title;
@property NSNumber *totalTime;
@property NSNumber *noMileStones;
@property NSString *goalDescription;
I setup breaking points and figured that when RLMRealm *realm = [RLMRealm defaultRealm];
is called the app terminates with following
'RLMException' exception: Property of type
NSNumber
must descend from RLMObject
Does anyone now how to get around this problem?
Upvotes: 0
Views: 2100
Reputation: 458
Since version 0.96.0, optional numbers can be stored using an NSNumber * property which is tagged with the type of the number. You can use NSNumber *, NSNumber *, NSNumber *, and NSNumber *.
Please check https://realm.io/news/realm-objc-swift-0.96.0/
Upvotes: 1
Reputation: 2497
The problem is that you're using NSNumber as type for your properties. Realm doesn't support that as NSNumber can be any numeric value (bool, integer, double, etc.). You must use types like int, float, double, etc. Please take a look at http://realm.io/docs/cocoa/0.81.0/api/Classes/RLMObject.html.
Upvotes: 5