How to Copy Folder to System folder in Cocoa
I am developing an application in cocoa which needs to copy开发者_如何学运维 a set of files to the system folder. When copying files to system folder I am getting a "Permission denied " error message . How can I resolve this problem.
Please any one help me...
Thanks in advance
It shouldn't be necessary to put anything in /System, and it's probably not a good idea anyway, as it could get wiped out by a system update. My guess is that whatever you're looking to do should be possible by some other means, e.g. using /Library or ~/Library.
Mac OS X uses a system of authorization that prevent application to copy files in system locations without warning. That's why you have to enter your credentials when installing a framework for example.
If you want to perform privileged operations in your application, I suggest you to read the Authorization Services Programming Guide and especially the Scenarios chapter: it will help you to decide how to do the file copy.
Use PackageMaker to make a proper Installer package, like I suggested on your previous question.
精彩评论