Search code examples
cocoaappstore-approvalmac-app-store

Is doing a command like "defaults write com.blahblah key true" a private API?


The Mac App Store guidelines say you can't use private APIs.

I'm toying with an app that modifies a Finder setting using a terminal command setting showAllFiles to true:

defaults write com.apple.Finder AppleShowAllFiles TRUE

Is there any way to be able to submit something like this into the Mac App Store? It seems like a private API to me. My question is: is there a public equivalent?


Solution

  • I think it would depend on how you execute this command. What C/ObjC APIs are you using to execute this? There are certainly public APIs which could be used to execute this command.

    However, an important thing to keep in mind is that Apple will require apps submitted to the Mac App Store to adopt their "Sandboxing" scheme starting in March 2012. Docs here:

    http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html

    I suspect that executing this command (even through public APIs) in a Sandboxed app will require that you declare the need for a special entitlement. More details on Entitlements here:

    http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Introduction/AboutEntitlements.html%23//apple_ref/doc/uid/TP40011195

    Specifically, I think you might need this "temporary entitlement":

    com.apple.security.temporary-exception.files.home-relative-path.read-write
    

    as I believe writing user defaults of an app like Finder would entail writing to a file on disk under the user's home dir:

    ~/Library/Preferences/com.apple.finder.plist