my code is below :
NSURL *urlID = [objID URIRepresentation];
NSString *strID = [urlID absoluteString];
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:strID, @"objectID", nil];
localNotification.userInfo = infoDict;
then i want to get the objected like this:
NSString *strID = [notification.userInfo objectForKey:@"objectID"];
NSURL *urlID = [[NSURL alloc] initWithString:strID];
NSManagedObjectID *objID = [[NSPersistentStoreCoordinator alloc] managedObjectIDForURIRepresentation:urlID];
but the objID is nil. anything wrong ? how to do that ? thank you !
If this is your actual code, then the line below is suspect
You are allocating a new NSPersistentStoreCoordinator, uninitialized, without any stores added to it. As per the documentation, it will return nil if no matching stores are found.
If you have the managed object context handy, following should work
otherwise i'd agree with svena's reply.