What if you print out [psc persistentStores] ?

I think you'll find the PSC is surprisingly fussy about the URLs. e.g. 
capitalisation seems to matter. So do trailing slashes. Oh, and also the 
difference between:

file:///foo.bar
file://localhost/foo.bar

On 12 Mar 2010, at 15:48, Gideon King wrote:

> I know that the URL is valid and it's readable. I can open the file in my 
> application. I can read it into an NSData with dataWithContentsOfURL: 
> 
> The purpose of what I am doing is trying to migrate to an XML store to see if 
> that will help me isolate the problem I am having with "save as", which I 
> posted about before.
> 
> Here's what I do in my test in my persistent document:
> 
>       NSPersistentStoreCoordinator *psc = [[self managedObjectContext] 
> persistentStoreCoordinator];
>       NSURL *oldURL = [NSURL 
> fileURLWithPath:@"/Users/gideon/Development/TestNMDocs/Untitled11.nm5"];
>       NSURL *newURL = [NSURL 
> fileURLWithPath:@"/Users/gideon/Development/TestNMDocs/Untitled11.xml"];
> 
>       NSError *error;
>       NSPersistentStore *myStore = [psc persistentStoreForURL:oldURL];
>       NSPersistentStore *xmlStore = [psc migratePersistentStore:myStore
>                                                                               
>                             toURL:newURL
>                                                                               
>                           options:nil
>                                                                               
>                          withType:NSXMLStoreType
>                                                                               
>                             error:&error];
> 
> oldURL is verifiably present, readable and valid, but myStore is always nil.
> 
> Any ideas?
> 
> Thanks
> 
> Gideon_______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to