如何在Cocoa app中存储数据?

时间:2022-04-15 23:06:59

I hope to migrate one of my windows app to mac.

我希望把我的一个windows应用程序移植到mac上。

As we know, on vista/win7, there are public data directories that one app can add, save and delete data files without RAC permission.

正如我们所知,在vista/win7上,有一些公共数据目录,一个应用程序可以在没有RAC权限的情况下添加、保存和删除数据文件。

Are there same directories on Mac/Cocoa?

Mac/Cocoa上有相同的目录吗?

or

I can store the data to any directory without any problem and any permission?

我可以将数据存储到任何目录,没有任何问题和任何权限?

Welcome any comment

欢迎任何评论

2 个解决方案

#1


6  

You can, by default, unless you enable sand-boxing, write to any directory the user has access to. Generally though, Cocoa apps store data in the user's home directory in ~/Library/Application Support/<your-app-name>

默认情况下,除非启用了沙箱,否则可以写入用户访问的任何目录。一般来说,Cocoa应用程序会将数据存储在~/Library/Application Support/ 中的用户主目录中

#2


6  

These are the 3 you can write to:

以下是你可以写信给的三个人:

~/Library/Application Support/app-identifier

~ /图书馆/应用支持/ app-identifier

~/Library/app-identifier

~ /图书馆/ app-identifier

~/Library/Caches/app-identifier

~ /图书馆/缓存/ app-identifier

(replace app-identifer with your app identifier)

(将app标识符替换为app标识符)

More info here under "File-System Usage Requirements for the Mac App Store"

更多关于“Mac应用商店文件系统使用要求”的信息

#1


6  

You can, by default, unless you enable sand-boxing, write to any directory the user has access to. Generally though, Cocoa apps store data in the user's home directory in ~/Library/Application Support/<your-app-name>

默认情况下,除非启用了沙箱,否则可以写入用户访问的任何目录。一般来说,Cocoa应用程序会将数据存储在~/Library/Application Support/ 中的用户主目录中

#2


6  

These are the 3 you can write to:

以下是你可以写信给的三个人:

~/Library/Application Support/app-identifier

~ /图书馆/应用支持/ app-identifier

~/Library/app-identifier

~ /图书馆/ app-identifier

~/Library/Caches/app-identifier

~ /图书馆/缓存/ app-identifier

(replace app-identifer with your app identifier)

(将app标识符替换为app标识符)

More info here under "File-System Usage Requirements for the Mac App Store"

更多关于“Mac应用商店文件系统使用要求”的信息