• 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: 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


  • Follow-Ups:
    • 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: Single column NSListView bug?
  • Previous by thread: Managed Object URI's not working?
  • Next by thread: Re: Managed Object URI's not working?
  • Index(es):
    • Date
    • Thread