File access in a sandboxed Mac app with swift

前端 未结 3 821
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 01:14

I am working on an app for OS X 10.9 with swift, sandboxed.

The app needs access to a SQLite database file. I let the user choose/open a file with NSOpenPanel. I then sa

3条回答
  •  名媛妹妹
    2021-02-02 01:47

    security scoped bookmarks is exactly the way to go. good starting point is apple documentation on AppStore sandbox (which includes sample code) and class reference of NSFileManager.

    you then will not store the path in user defaults but the binary data of the bookmark.

提交回复
热议问题