由于必填字段无法保存CoreData对象 - 但已定义

时间:2017-04-26 15:51:19

标签: ios core-data

当我尝试调用managedObjectContext.save().时出现以下错误消息:此错误很少发生。

NSError [CoreDataController.swift:86] saveContext()
nil
Optional(Error Domain=NSCocoaErrorDomain Code=1570 "merchant_id is a required value." UserInfo={NSValidationErrorKey=merchant_id, NSLocalizedDescription=merchant_id is a required value., NSValidationErrorObject=<CachedOfferImpl: 0x174097ca0> (entity: CachedOffer; id: 0x174231480 <x-coredata:///CachedOffer/t65EAE795-06CD-4721-AB96-E5EEFE93EF005> ; data: {
    "blacklisted_date" = nil;
    "cached_date" = "2017-04-12 15:48:08 +0000";
    "end_date" = "2017-04-17 21:00:00 +0000";
    "is_informational" = 1;
    "merchant_id" = 1466698568445;
    "merchant_name" = "National Building Museum";
    "offer_id" = 1484158985996;
    "offer_instances" =     (
    );
    "offer_title" = "Around the world in 80 Paper Models!";
    "saved_date" = nil;
    "saved_date_section_title" = nil;
    "stored_notifications" = nil;
    "thumbnail_url" = "http://images...com/...jpg";
})})

错误是说merchant_id是必需值,但同时显示的是具有定义值的对象。

0 个答案:

没有答案