NSPersistentDocument Migration with Sandbox
NSPersistentDocument Migration with Sandbox
- Subject: NSPersistentDocument Migration with Sandbox
- From: Jim McGowan <email@hidden>
- Date: Thu, 09 May 2013 12:20:43 +0800
Hi,
I'm working on an update to a Core-Data document app, and have a new version of the document model. I've got automatic migration (with a mapping model) of documents in the old format working fine when the app is run without sandboxing. However, when running in the sandbox, migration fails at the end when the migrated data is prevented from being written to disk by the sandbox. sandboxd gives this message on the console:
deny file-write-create /Users/jimmcgowan/Desktop/.AGPS Examples.rtd.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3
And my app gives out:
CoreData: error: (migration) migration failed with error Error Domain=NSCocoaErrorDomain Code=134110 "An error occured during persistent store migration." UserInfo=0x1006ab1b0 {NSUnderlyingError=0x100693de0 "The file couldn’t be saved.", reason=Can't add destination store}
Error User Info: {
NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=512 \"The file couldn\U2019t be saved.\" UserInfo=0x100642d80 {NSUnderlyingException=Error validating url for store}";
reason = "Can't add destination store";
}
Underlying error: Error Domain=NSCocoaErrorDomain Code=512 "The file couldn’t be saved." UserInfo=0x100642d80 {NSUnderlyingException=Error validating url for store}
Error User Info: {
NSUnderlyingException = "Error validating url for store";
}
I've spent a day looking into this and Googling around, but there doesn't seem to be much information out there. I've found a couple of posts with others encountering this problem, but the solutions are either to use the temporary entitlement for absolute-path.read-write or to hijack the migration process to display a save dialogue to get user permission for the destination URL. Neither of these are appropriate as the former will most likely mean MAS rejection, and the later creates a confusing user experience (opening a document shouldn't immediately present a save dialogue).
Has anyone else run into this? Any suggestions for a better workaround?
Thanks,
Jim
_______________________________________________
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