Re: Managed Object URI's not working?
Re: Managed Object URI's not working?
- Subject: Re: Managed Object URI's not working?
- From: "John R. Timmer" <email@hidden>
- Date: Sun, 02 Dec 2007 13:15:11 -0500
Thanks, that helped me identify the problem - it seems that the store
ID is changing in between when i store the IDs and when i retrieve
them from a separate app. When i check the store identifier, it's
24A24C62-1B60-44C6-9602-0F3011B5C71C
In contrast, the previously stored object URIs seem to have a
completely different store ID, even though it's the same exact file.
Printing description of objectURL:
<CFURL 0x10339de20 [0x7fff7020b7c0]>{type = 15, string = x-coredata://
868BBB38-4830-45FA-98DF-21357091C402/ItemWrapper/p7445, base = (null)}
So, that at least gives me a better hint of what's going wrong.
Cheers,
John
On Dec 2, 2007, at 12:21 PM, Bill Garrison wrote:
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
_______________________________________________
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