问题
I've an open source project (gdal) that I want to compile and run as part of an iOS app. I had been expecting to use NSTask
but I see now that it was removed in iOS 3.0. I've also seen elsewhere that running external applications, though this would be a resource in my app's bundle, is not allowed.
Has anyone else found a way to run commandline tools within their iOS applications?
回答1:
It wasn't removed in 3.0, it was never there. There is no way to run separate processes on the iPhone. GDAL appears to be under an MIT style license and has a library interface, so directly linking it into an iPhone app shouldn't have any legal or technical issues.
回答2:
NSTask is available in ios 4, ios 3 and possibly all of them. To use NStask I had to copy the NStask header file from my mac to my project folder. Also Apple will most likely not allow an app that uses NStask in the appstore. Cydia would probably be the best place to distribute your app
回答3:
Just reminder:
NSTask will not work under sandbox environment (you will get "deny process-fork"). So put your application into /Applications
来源:https://stackoverflow.com/questions/1536400/nstask-or-equivalent-for-iphone