Re: What would cause persistentStoreForURL: to return nil?
Re: What would cause persistentStoreForURL: to return nil?
- Subject: Re: What would cause persistentStoreForURL: to return nil?
- From: Mike Abdullah <email@hidden>
- Date: Fri, 12 Mar 2010 16:09:21 +0000
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 (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