1

I have an existing OSX app that supports OSX 10.5 onwards. I want to publish it to the AppStore and therefore I need to sandbox the app. I guess sandbox app should be supporing 10.7 onwards.

  • The app uses a folder in the username directory to create temp files etc
  • It also copies a sql db file which already has empty tables to the same temp folder and upates records as the app is used.
  • Furthermore if there is a crash it picks up logs from the crashlog folder of osx and requests user to submit them to developer.

Question

with a sanbox app, where do I store temp files ? Where should I place the db file which can be read/witten to + new App update should be able to find exsting db file. Should the custom code for crash reporter be kept or be made redundant ?

Thanks

2540625
  • 11,022
  • 8
  • 52
  • 58
Ahmed
  • 14,503
  • 22
  • 92
  • 150

2 Answers2

0

where do I store temp files ?

In the directory recommended by NSTemporaryDirectory(). (This applies to both sandboxed and non-sandboxed applications.)

Where should I place the db file which can be read/witten to

In your application's Application Support directory. Use NSSearchPathForDirectoriesInDomains() to find it, then append your application's name. Again, this is the same whether you're sandboxed or not.

new App update should be able to find exsting db file.

Not possible. You can ask the user to locate the existing file with a NSOpenPanel, but you can't open it yourself, because it'd be outside your sandbox.

Should the custom code for crash reporter be kept or be made redundant ?

You'll need to remove it, because it won't work under sandboxing — crash reports are not stored to your sandbox. You will receive crash reports for your application through iTunes Connect.

Alternatively, you may want to look into a third-party crash reporting service like PLCrashReporter.

Community
  • 1
  • 1
  • Just need clarification. When new app update is published if it can not find existing db file, does it mean it is same as removing app and reinstalling an app ? thereby all configuration settings or any cached data of previous version is lost when there is an update ? and there is no way for updated version to find any data from previous version ? – Ahmed Jul 24 '14 at 20:18
  • Data stored in the sandbox is kept in place when your application is updated. –  Jul 24 '14 at 20:41
  • Thanks, so essentially I can copy my db file in the sandbox folder to let the new version access it. true right ? – Ahmed Jul 24 '14 at 21:16
  • Correct. You'll just need some help from the user to do that, as the sandboxed application can't reach outside of its sandbox to get the old database file itself. –  Jul 24 '14 at 22:34
0

There is a mechanism to migrate the data of an existing App into the sandbox: Migrating an App to a Sandbox on developer.apple.com

This is done once the newly sandboxed app is launched the first time. If you can determine where the database was stored, you can migrate it into the sandbox.

mahal tertin
  • 3,239
  • 24
  • 41