I am trying to install a software. I tried running a script which calls
installer -pkg /path/to/software.pkg -target /
when i try calling the script via objective-c code like
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:@"/path/to/script"];
[task launch]
The installation fails , when i try to execute the same using the system() command like
NSString* run_Command = @"/path/to/script"
system([run_Command UTF8String])
The application gets installed , upon checking the install.log to see why the first one failed, i found this line
./postinstall: LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Software.app
PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “software.pkg”
Am i using NSTask
in a wrong way or will changing any setting or environment variable make the NSTask
work?
When i looked into LSOpenURLsWithRole()
failed with error -10810 , i could only find that it was a matter of permission error and a -chmod will resolve the issue.