Read and write permission for user selected folder in Mac OS app?

前端 未结 3 1227
清歌不尽
清歌不尽 2020-12-30 12:12

I am developing MAC OS app which have functionality to create file on the behalf of your. First user select folder for storing file (One time at start of app) and then user

3条回答
  •  长发绾君心
    2020-12-30 13:08

    Add user-selected and bookmarks.app permissions in entitlement file :

    com.apple.security.files.user-selected.read-write
    
    com.apple.security.files.bookmarks.app-scope
    
    

    Then open folder selection using NSOpenPanel so the user can select which folders to give you access to. The NSOpenPanel must be stored as a bookmark and saved to disk. Then your app will have the same level of access as it did when the user selected the folder.

提交回复
热议问题