Core Data Inverse Relationship Not Being Set

前端 未结 3 511
情话喂你
情话喂你 2020-12-18 23:17

I\'ve got two Entities that I\'ll call A and B. They are configured with To-Many relationships in both directions, so A.myBs and B.myAs are both NSSets.

Here is

3条回答
  •  旧时难觅i
    2020-12-19 00:10

    I found the error, if you are overriding any of these methods

    // KVO change notification
    - (void)willChangeValueForKey:(NSString *)key;
    - (void)didChangeValueForKey:(NSString *)key;
    - (void)willChangeValueForKey:(NSString *)inKey withSetMutation:(NSKeyValueSetMutationKind)inMutationKind usingObjects:(NSSet *)inObjects;
    - (void)didChangeValueForKey:(NSString *)inKey withSetMutation:(NSKeyValueSetMutationKind)inMutationKind usingObjects:(NSSet *)inObjects;
    

    it will cause NSManagedObject don't work well and the relationships won't be set correctly

    Apple documentation: You must not override these methods.

提交回复
热议问题