我的代码如下:
NSURL *urlID = [objID URIRepresentation];
NSString *strID = [urlID absoluteString];
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:strID, @"objectID", nil];
localNotification.userInfo = infoDict;
然后我想得到这样的反对:
NSString *strID = [notification.userInfo objectForKey:@"objectID"];
NSURL *urlID = [[NSURL alloc] initWithString:strID];
NSManagedObjectID *objID = [[NSPersistentStoreCoordinator alloc] managedObjectIDForURIRepresentation:urlID];
但 objID 为零。哪里不对了 ?怎么做 ?谢谢你 !