is there a way to get the log from system(); so like when I do system("open com.apple.nike");
I should get Couldn't open application: com.apple.nike. Reason: 8, application disabled or restricted
. This will run on my iOs 7 Device
Thanks
EDIT:// This is the new code, but it wont work, I'll get
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
*** First throw call stack:
NSString *bundleID = @"com.apple.nike";
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @"sudo"];
[task setArguments: [[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"open %@", bundleID], nil]];
NSPipe *pipe= [NSPipe pipe];
[task setStandardOutput: pipe];
NSFileHandle *file = [pipe fileHandleForReading];
[task launch];
NSData *data = [file readDataToEndOfFile];
NSString *output = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog(@"result: %@", output);