NSTask or equivalent for iPhone [closed]
Asked Answered
T

3

8

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?

Troup answered 8/10, 2009 at 8:24 Comment(2)
I'm currently trying for a similar thing, did you ever end up getting this to work?Faubion
I know this is an old thread but its the first thing that comes up for google nstask on iphone I figued it out for jailbroken iphones:#9983930Plenipotentiary
C
8

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.

Creech answered 8/10, 2009 at 9:36 Comment(3)
Thanks Louis, Is it the same process as linking into a one of the Apple-supplied frameworks? libgdal.a is about 40mb, considerably larger than the rest of my project, so I was hoping to just use the executable gdalinfo (about 5mb) but that doesn't look like something I can directly link to. I know there aren't a lot of opensource iPhone apps but if you happen to know any that do link in code other than Apple's frameworks, I'd be really interested in seeing how it is done.Troup
Well, obviously the amount of code needed for the functionality you want must be less than 40 megabytes. Whether you can effectively carve it out is a separate issue. Also, I would think that 40 megs means it is unstripped and has all the debug symbols (which can be quite large). How much does it shrink if you strip it?Creech
I think I'm going to have to ask a lot more questions on this site. I'm not sure how to go about stripping the debug symbols. It was compiled using "build_for_iphoneos" a script written by Christopher Stawarz, perhaps there are some notes on what flags I need to set. In the meantime I'll try importing it like a framework and seeing what functions I can run on the full 40mb version.Troup
C
1

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

Coventry answered 19/8, 2010 at 4:50 Comment(5)
Did you test this on a device? If you just tested in the simulator, it would have used the Mac OS X source, as NSTask.m, the most necessary file, would be missing.Lawerencelawes
I believe I tested it on a device but I can't rememberCoventry
NSTask is on iOS you need the header for it to compile that's all.Christiansand
Here is a copy of NSTask.h from rpetrich's github repo.Brashy
This does not work on iOS 8 when using these steps you will get: dyld: problem loading iOS simulator dyldRudie
I
0

Just reminder:
NSTask will not work under sandbox environment (you will get "deny process-fork"). So put your application into /Applications

Inexpiable answered 10/8, 2012 at 3:28 Comment(2)
uh? I don't think you get much choice about where iPhone apps get deployed to.Troup
Question: How do I copy it? To my normal projekt-folder and than to #import it? --------- What is about the Jailbreak-comment? Is it true that Apple will rejected the app from the store if NSTask is used on iOS? ---------- I want to do this: #16627077Crimea

© 2022 - 2024 — McMap. All rights reserved.