AFIncrementalStore Problems fetching multiple remo

2019-09-06 17:20发布

问题:

I have a problem with AFIS fetching remote relationships, i'm connecting to Apigee API, properly setting relationships at

- (NSDictionary *)representationsForRelationshipsFromRepresentation:(NSDictionary *)representation
                                                           ofEntity:(NSEntityDescription *)entity
                                                       fromResponse:(NSHTTPURLResponse *)response;

then, spent a lot of time debugging, found that relation name and URL build is correct, exactly as i want but the AFHTTPClient never makes the network call, found out the reason in method:

- (id)newValueForRelationship:(NSRelationshipDescription *)relationship
              forObjectWithID:(NSManagedObjectID *)objectID
                  withContext:(NSManagedObjectContext *)context
                        error:(NSError *__autoreleasing *)error;

line

if ([request URL] && (![[context existingObjectWithID:objectID error:nil] hasChanges]))

because hasChanges always returns YES.

Any advice ?