osx - How to ask for a permission for user's files using NSOpenPanel in objective c? -
i having cocoa mac app in want ask user's permission using nsopenpanel.
in app, deleting data downloads folder, application caches , mail downloads.
when submitted app, app got rejected below reason.
the app finds files in ~/downloads folder. appropriate have user grant access home folder.
so, used nsopenpanel asking access user.
i able open dialogue box nsopenpanel.
now, not aware of should on allow button.
what meaning of that?
i have enabled app sand boxing mode on app store distribution.
please guide me on this...
edit
i have come know i'll have use security scope bookmark this.
so in projname.entitlements file, added key com.apple.security.files.bookmarks.app-scope
, set boolean value yes
.
now did below code save...
nsurl* url = [panel url]; nsdata* data = [url bookmarkdatawithoptions:nsurlbookmarkcreationwithsecurityscope includingresourcevaluesforkeys:nil relativetourl:nil error:nil]; nslog(@"%@",data); if (data) { nsuserdefaults* prefs = [nsuserdefaults standarduserdefaults]; [prefs setobject:data forkey:@"exportdirectory"]; [prefs synchronize]; }
now, how access data when launch app again?
Comments
Post a Comment