OSX file access issue

54 Views Asked by At

My app works in xcode, copying files from its bundle to caches and executing shell/java using NSTask. When exported and run without Xcode, it cannot access those files. What Am I missing? I have iOS Developer Signing identity only, no Mac Dev account (yet).

2

There are 2 best solutions below

0
Mads Y On

Make sure the files are copied to the .app file after compilation.

If they are present, then you might be accessing them on the wrong path? Do you remember to use [NSBundle mainBundle] to get their path?

You can use something like this:

[[NSBundle mainBundle] pathForResource:@"file" ofType:@"sh"];
0
igraczech On

This was actually a sandbox feature since OS X has it... that's why the app ran in developer mode (which has actually root privileges) without any issues and behaved erraticaly when running inside its proper sandbox.

Once I've acquired Mac Developer account besides my existing iOS developer program, the app works always as expected (both as Xcode Run and as regular app installed to Applications).