I have a MAC OSX cocoa application,where i used NSAppleScript to run some script with administrator privileges .The application works fine when it is launched manually or from any other script .
But NSAppleScript doesn't launch the intended script when i tried to launch the application from package maker .
I have made a postflight script to launch the application from package maker .
Postflight:
#!/bin/sh
open pathOFApp
NSAppleScript usage:
NSDictionary *error = [NSDictionary new];
NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:@"do shell script \"pathOFScript \" with administrator privileges"];
if ([appleScript executeAndReturnError:&error]) {
NSLog(@"-----success --------");
}
else{
NSLog(@"-------Failure-----");
}
Please help to fix this .