1
我想以編程方式將字體複製到位置/ System/Library/Fonts /。我用下面的代碼來做到這一點如何以編程方式將字體複製到/ System/Library/Fonts /?
NSFileManager *fileManager=[NSFileManager defaultManager];
[fileManager copyItemAtPath:sourcePath toPath:@/System/Library/Fonts error:&error];
爲此,我正在錯誤..
Error Domain=NSPOSIXErrorDomain Code=13 UserInfo=0x4193e0 "The operation couldn’t be completed. Permission denied"
如果我手動拷貝字體就先問密碼,將其複製到的位置。但是,如果我以編程方式完成此操作,則意味着它不會要求輸入密碼。我如何實現這個功能?
一般來說,你不應該在/ System/Library中安裝任何東西。/System/Library是針對Apple提供的核心繫統組件;本地和第三方添加,自定義等全部屬於/ Library(用於系統範圍的資源和設置)或〜/ Library(每用戶資源和設置)。請參閱[Apple的文件系統文檔](http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html%23//apple_ref/doc/uid/TP40010672-CH2-SW15 )以獲得更多解釋。 –
@gordon davisson:感謝您的兄弟爲您的寶貴信息和鏈接..假設如果我在我的應用程序中完成了這一點,蘋果是否會拒絕該應用程序? – Aravindhan
如果你的意思是Mac App Store,我很肯定他們會拒絕它。 [Apple規則](https://developer.apple.com/appstore/mac/resources/approval/guidelines.html)禁止在共享位置安裝資源的應用程序(規則2.15),升級到根目錄(規則2.27)或違反文件系統文檔(規則2.30)。 –