• 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
CoreData, automatic migration and sandbox problems.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData, automatic migration and sandbox problems.


  • Subject: CoreData, automatic migration and sandbox problems.
  • From: Samuel Williams <email@hidden>
  • Date: Tue, 29 May 2012 01:59:14 +1200

Hi,

I'm having trouble with automatic migrations and sandbox.

When the user opens an old file, the automatic migration fails due to no
write permission to the file.

-
(BOOL)configurePersistentStoreCoordinatorForURL:(NSURL*)url
ofType:(NSString*)fileType modelConfiguration:(NSString*)configuration
storeOptions:(NSDictionary*)storeOptions error:(NSError**)error

{

NSMutableDictionary *options = nil;

 if (storeOptions != nil) {

options = [storeOptions mutableCopy];

} else {

options = [[NSMutableDictionary alloc] init];

}


[options setObject:[NSNumber numberWithBool:YES]
forKey:NSMigratePersistentStoresAutomaticallyOption];

[options setObject:[NSNumber numberWithBool:YES]
forKey:NSInferMappingModelAutomaticallyOption];

*//[options setObject:[NSNumber numberWithBool:YES]
forKey:NSReadOnlyPersistentStoreOption];*

 BOOL result =
[super configurePersistentStoreCoordinatorForURL:url ofType:fileType
modelConfiguration:configuration storeOptions:options

 error:error];

 *//if (*error) {*

* //      *** Fails here ****

*// [[NSAlert alertWithError:*error] runModal];*

*//}*

 [options release];

 return result;

}


Just wondering if anyone has a suggestion about how I can avoid writing to
the file, e.g. forcing the user to re-save or duplicate the document before
attempting the migration. It works fine for non-sandbox builds.

Kind regards,
Samuel
_______________________________________________

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: CoreData, automatic migration and sandbox problems.
      • From: Dave Fernandes <email@hidden>
  • Prev by Date: Re: Losing memory
  • Next by Date: Re: Page number in UIWebView
  • Previous by thread: Re: NSXMLParser and initWithStream
  • Next by thread: Re: CoreData, automatic migration and sandbox problems.
  • Index(es):
    • Date
    • Thread