@interface ModelClass : SCObject
@property (strong, nonatomic) NSString *scObjectID;
@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *videoUrlHLS;
@property (strong, nonatomic) NSString *fileUrlDirect;
@implementation ModelClass
+ (NSDictionary *)JSONKeyPathsByPropertyKey
{
return @{ Key(ModelClass, scObjectID) : @"MediaId",
Key(ModelClass, title) : @"Title",
Key(ModelClass, videoUrlHLS) : @"VideoUrlAppleHLS",
Key(ModelClass, fileUrlDirect) : @"FileUrlS3Direct"
}
fileUrlDirect 属性是新属性,并且更新了 JSONKeyPathsByPropertyKey 以将 json 属性转换为模型属性
@property (strong, nonatomic) NSString *fileUrlDirect;
Key(ModelClass, fileUrlDirect) : @"FileUrlS3Direct"
当我跑
[MTLManagedObjectAdapter managedObjectFromModel:instanceOfModelClass insertingIntoContext:context error:error];
我收到
[0] (null) @"NSLocalizedDescription" : @"Could not serialize managed object"
[1] (null) @"NSLocalizedFailureReason" : @"No property by name \"fileUrlDirect\" exists on the entity."
我已调试并确认 instanceOfModelClass 具有新属性,但我无法弄清楚为什么会出现此错误
我是 ios 开发的新手,我猜还有更多的东西需要连接才能让它工作,但我不确定是什么