3

I have to submit an application to Mac App Store and got rejected from Apple by this reasons

Apps that do not comply with the Mac OS X File System documentation will be rejected

In guidelines suggest to write file the following directories

  • ~/Library/Application Support/{app-identifier}
  • ~/Library/{app-identifier}
  • ~/Library/Caches/{app-identifier}

but my files is temporary,cache files, then It can be write my file into NSTemporaryDirectory() and It will violate with guidelines ?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
meddlesome
  • 551
  • 7
  • 20

2 Answers2

7

NSTemporaryDirectory() is appropriate for temporary files.

~/Library/Application Support/{app-identifier}

This directory is for permanent files generated at run-time by your app.

~/Library/{app-identifier}

This directory is a catch all for most files created by your app. You have ownership of this directory.

~/Library/Caches/{app-identifier}

This directory is for temporary files which your app can recreate, but which it wants to keep on disk as long as possible. Files here may be deleted by the OS.

Jonathan Grynspan
  • 43,286
  • 8
  • 74
  • 104
  • As read in some comment of using `NSTemporaryDirectory()` is risk to return `nil` in some case. then i'm using `~/Library/Caches/{app-identifier}` instead that is a good way to store caching file in OSX. Thanks – meddlesome Jul 14 '11 at 22:25
  • 3
    You should use the result of `NSSearchPathForDirectoriesInDomains()` rather than hard-coding those paths, in any case. :) – Jonathan Grynspan Jul 14 '11 at 23:38
2

I've written a simple library to return all these paths using the correct system functions, and with logic to automatically create them if they don't already exist (as is the case with ~/Application Support/AppName, etc).

https://github.com/nicklockwood/StandardPaths

Nick Lockwood
  • 40,865
  • 11
  • 112
  • 103