Xcode Objective C How to write in system's directory (Mac Os)? -
Xcode Objective C How to write in system's directory (Mac Os)? -
i want write txt file in /macintosh hd/library/preferences folder:
nsstring *fullpath = [@"/library/preferences" stringbyappendingpathcomponent:@"some_txt_file.txt"]; nsstring *str = @"some text"; [str writetofile:fullpath atomically:true encoding:nsutf8stringencoding error:null];
but not working. if alter properties "read , write" in window, code working:
http://s52.radikal.ru/i135/1411/d0/32babf6a05a0.png
when alter options, scheme inquire me password!
how can inquire password , receive administrator promts write in directory cocoa application mac os, when click button?
many thanks!
first of should reconsider whether need write here , not ~/library/preferences
(in user directory rather root). preferences per-user things.
if need write in /library/preferences
(root) need elevated privleges. apple provides sample of here. note unless i'm mistaken, app rejected if planning set in on mac app store.
objective-c xcode osx cocoa
Comments
Post a Comment