I want to use NSTask to run a shell script that resides in Resouces directory. The script performs some operations on files in the app's Data directory.
But I am concerned that Apple could refuse my app for some reasons. Can anyone confirm if this approach is safe. Thanks.
Mac App Store apps are, in general, allowed to run other executables from within their bundle, and that includes shell scripts. There are two obvious gotchas here:
The shell script must be built in to your app. This is based on guideline 2.16 (that bob133 has helpfully pasted in above so I don’t need to provide a reference).
The script will only be able to access data in your app’s container. This is enforced by the App Sandbox. In compiled code you can use security scoped bookmarks to retain persistent access to areas outside of your app’s container, but that’s hard to do in a shell script.
It sounds like you have both of these issues in hand so I agree that it’s reasonable to submit your app and see what App Review makes of it.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"