Say you want to use functionality or interact with another third-party application. Is it possible to link against an executable in an objective-c project? Can the binary maybe be wrapped inside a framework?
You can use an XCode copy files phase to put an additional executable in with your main one, in Your.app/Contents/MacOS, then (let's say you copied grep) to locate it use [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"grep"].
I do it a little differently, for example I have a Python program one of my apps calls (getting the response in plist format which is nice) and I just have it copied into the My.app/Contents/Resources directory and use [[NSBundle mainBundle] pathForResource:@"myScript" ofType:@"py"] to find it.
Which way you do it is, I suspect, a matter of taste. I think it makes sense to put compiled executables in with the main one, and Python/Perl/whatever in Resources. From there it's just a matter of setting up an NSTask to launch and pipe the aux program's output back into your main executable. More info on that here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With