If this is your actual code, then the line below is suspicious
NSManagedObjectID *objID = [[NSPersistentStoreCoordinator alloc] managedObjectIDForURIRepresentation:urlID];
You assign a new NSPsistentStoreCoordinator, uninitialized, without any stores added to it. According to the documentation, it will return zero if no matching stores are found.
If you have a managed entity context, the following should work
NSManagedObjectID *objId = [[[self managedObjectContext] persistentStoreCoordinator] managedObjectIDForURIRepresentation:urlID];
otherwise, I agree with svena's answer.
source
share