• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Managed Object URI's not working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:25:53 -0500

As a further follow up, i can grab the new store ID and use it to replace the store ID in the string representation of the URI. The resulting URI seems to work beautifully, although this doesn't seem to be a safe, long-term solution.

JT

On Dec 2, 2007, at 1:15 PM, John R. Timmer wrote:

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

_______________________________________________

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


References: 
 >Re: Managed Object URI's not working? (From: Bill Garrison <email@hidden>)
 >Re: Managed Object URI's not working? (From: "John R. Timmer" <email@hidden>)

  • Prev by Date: Re: ImageKit + GC = nogo? (or better... how :D)
  • Next by Date: Remove custom views from NSOutlineView
  • Previous by thread: Re: Managed Object URI's not working?
  • Next by thread: Re: Multiple applications, one NSUserDefaults object?
  • Index(es):
    • Date
    • Thread