领域错误:属性需要一个定义包含类型的协议

Bla*_*rai 3 objective-c realm ios

我有以下模型,我正在使用Realm:

@interface GUIRoutineModel : GUIModel # GUIModel is a subclass of RLMObject

@property (nonatomic, retain) NSString *dateCreated;
@property (nonatomic, retain) NSString *dateModified;
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *type;

@property NSInteger userId;
@property int routineId; #also have same issue using NSInteger


@end
Run Code Online (Sandbox Code Playgroud)

我打电话的时候:

   // Persist to Realm DB
    RLMRealm *realm = [RLMRealm defaultRealm];
    [realm transactionWithBlock:^{
        [realm addObject:routineModel];
    }];
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

'Property 'routineId' requires a protocol defining the contained type - example: NSNumber<RLMInt>.'
Run Code Online (Sandbox Code Playgroud)

我已经尝试将routineId属性更改为NSNumber<RLMint>,但这也无效.谁能告诉我我做错了什么?

更新:

这是我尝试的另一个版本的模型:

@interface GUIRoutineModel : GUIModel

@property (nonatomic, retain) NSString *dateCreated;
@property (nonatomic, retain) NSString *dateModified;
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *type;

@property NSInteger userId;
@property NSNumber<RLMInt> *routineId;

@end
Run Code Online (Sandbox Code Playgroud)

bda*_*ash 6

Property requires a protocol defining the contained type error仅由境界类型的属性产生NSNumber未经协议注释所述预期的具体类型.这意味着无法为您提到的任何一个模型类生成它.您可能routineId在应用程序的其他位置有另一个触发错误的属性.