Under MacOS, you can use the Authorizationexecutewithprivileges function to run a program as an administrator, which will pop up a box to enter a password if run with administrator privileges. And the execution of this program if the administrator to execute another program, will pop up a box. This means that permissions are not inherited.
The person who wrote the Windows program should know that if running the program as an administrator in the Win7 will pop up the UAC prompt, but the program is running, if you run another program, then the other program is an administrator, and does not play the UAC prompt, this means that permissions are inherited.
Below we implement permissions inheritance under Mac
#import <Cocoa/Cocoa.h> #import "STPrivilegedTask.h" int main (int argc, const char * argv[]) { Stprivilegedtask *mytask = [[Stprivilegedtask alloc] init]; NSString *fullpath = @ "/applications/test.app/contents/macos/test"; Nsarray *args = [Nsarray arraywithobjects: @ "Install", nil]; Parameters [MyTask Setlaunchpath:fullpath]; [MyTask Setarguments:args]; [MyTask launch]; Return Nsapplicationmain (argc, argv);}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Objective-c MacOS Administrator Rights inheritance