1
我在理解如何授權我的程序執行特權任務時遇到問題。理解授權的問題
我讀蘋果文檔寫了這樣一段代碼:調用AuthorizationCopyRights我應該能夠執行特權任務,右後
AuthorizationRef myAuthorizationRef;
OSStatus myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef);
AuthorizationItem myItem;
myItem.name = "com.Me.myApp.test";
myItem.valueLength = 0;
myItem.value = NULL;
myItem.flags = 0;
AuthorizationRights myRights;
myRights.count = 1;
myRights.items = &myItem;
AuthorizationFlags myFlags = kAuthorizationFlagDefaults |
kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights;
myStatus = AuthorizationCopyRights (myAuthorizationRef, &myRights, kAuthorizationEmptyEnvironment, myFlags, NULL);
?我還有什麼要做的嗎?