简体   繁体   English

在xcode中建模的新属性导致NSLocalizedDescription-无法序列化托管对象

[英]new property to model in xcode results in NSLocalizedDescription - Could not serialize managed object

@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"
}

The fileUrlDirect property is the new property and the JSONKeyPathsByPropertyKey was updated to translate json property to model property fileUrlDirect属性是新属性,并且JSONKeyPathsByPropertyKey已更新,可将json属性转换为模型属性

@property (strong, nonatomic) NSString *fileUrlDirect;
Key(ModelClass, fileUrlDirect) : @"FileUrlS3Direct"

When I run 当我跑步

[MTLManagedObjectAdapter managedObjectFromModel:instanceOfModelClass insertingIntoContext:context error:error];

I receive 我收到

[0] (null)  @"NSLocalizedDescription" : @"Could not serialize managed object"   
[1] (null)  @"NSLocalizedFailureReason" : @"No property by name \"fileUrlDirect\" exists on the entity."    

I've debugged and confirmed that the instanceOfModelClass has the new property but I can't figure out why I'm getting this error 我已经调试并确认instanceOfModelClass具有新属性,但我不知道为什么会收到此错误

I'm new to ios development and I'm guessing there is more to wire up for this to work but I'm not sure what 我是ios开发的新手,我想还有很多工作要做,但是我不确定

您正在将instanceOfModelClass映射到的核心数据实体中缺少名称为fileUrlDirect属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM