Re: Managed Object URI's not working?
Re: Managed Object URI's not working?
- Subject: Re: Managed Object URI's not working?
- From: Bill Garrison <email@hidden>
- Date: Sun, 2 Dec 2007 12:21:20 -0500
John,
You can do something like the following to confirm that the object ID
you have comes from a store that the persistent store coordinator
knows about.
{
NSArray *knownStores = [persistentStoreCoordinator persistentStores];
BOOL objectIDStoreIsKnown = [knownStores containsObject: [objectURL
persistentStore]];
NSAssert( objectIDStoreIsKnown, @"...or I'll know the reason why.");
}
- Bill
Problems arise when i try to use these to use these to grab objects.
The URL appears just as valid, but the Persistent Store Coordinator
can never find a valid corresponding ID.
for ( loopCounter = 0; loopCounter < theLimit; loopCounter++ ) {
objectURL = [NSURL URLWithString: [theIDArray objectAtIndex:
loopCounter]];
theObjID = [persistentStoreCoordinator
managedObjectIDForURIRepresentation: objectURL];
if ( theObjID != nil )
[theIDArray replaceObjectAtIndex: loopCounter withObject:
[persistentStoreCoordinator managedObjectIDForURIRepresentation:
objectURL]];
else
NSLog ( [objectURL description] ) ;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden