Mac App Store 指南规定您不能使用私有 API。
我正在玩一个应用程序,它使用终端命令将 showAllFiles 设置为 true 来修改 Finder 设置:
defaults write com.apple.Finder AppleShowAllFiles TRUE
有什么方法可以将这样的东西提交到 Mac App Store 中吗?对我来说,这似乎是一个私有 API。我的问题是:是否有公共等价物?
Mac App Store 指南规定您不能使用私有 API。
我正在玩一个应用程序,它使用终端命令将 showAllFiles 设置为 true 来修改 Finder 设置:
defaults write com.apple.Finder AppleShowAllFiles TRUE
有什么方法可以将这样的东西提交到 Mac App Store 中吗?对我来说,这似乎是一个私有 API。我的问题是:是否有公共等价物?
我认为这取决于您如何执行此命令。您使用哪些 C/ObjC API 来执行此操作?当然有公共 API 可以用来执行这个命令。
但是,要记住的重要一点是,从 2012 年 3 月开始,Apple 将要求提交到 Mac App Store 的应用程序采用他们的“沙盒”方案。此处的文档:
我怀疑在沙盒应用程序中执行此命令(即使通过公共 API)将需要您声明需要特殊权利。此处有关权利的更多详细信息:
具体来说,我认为您可能需要这种“临时权利”:
com.apple.security.temporary-exception.files.home-relative-path.read-write
因为我相信编写像 Finder 这样的应用程序的用户默认值将需要写入用户主目录下磁盘上的文件:
~/Library/Preferences/com.apple.finder.plist
I assume you tried to use NSUserDefaults
and found it has no real capacity to alter settings for other applications. Fortunately for you, the CFPreferences
API exists for this sort of purpose and can modify settings under any bundle identifier.
That said, the actual settings of other applications are implementation details private to those applications; even though you're not using a tool/API that's undocumented, you're making changes to another process, and that may fall afoul of the App Store rules.