osx - How can a Cocoa application add itself as a global login item? -
I tried
LSSharedFileListRef globalLoginItems = LSSharedFileListCreate (zero, kLSSharedFileListGlobalLoginItems, null); If (Global Log Entities) {LSSharedFileListItemRef ourLoginItem = LSSharedFileListInsertItemURL (GlobalLogin Item, KLS Sheriff List List List, NULL, NULL, (CFRRF) [[NSBundle Main Bundle] Bundle URL], Faucet, Null); If (our Latin Intam) {CFREIEEEEEEEEE (our login image); } Else {NSLog (@ "can not be included as a global login item itself"); } CFEEEEEEEECE (Global Legitim); } Else {NSLog (@ "Could not find global login items"); } LSSharedFileListInsertItemURL () Just returned when I ran and ran the application. Do I need to do something else? Some types of authorization
Note:? Use-case here for the global login items, that is using kLSSharedFileListGlobalLoginItems and kLSSharedFileListSessionLoginItems
I got this job all I had to do was add these lines before I insert the app into the login item:
AuthorizationRef authentication = zero; Authorization (authorization of tap, authorization of empty environment environment, authorization, flag default, & amp; auth); LSSharedFileListSetAuthorization (Global Log Entities, Oath); is to get LSSharedFileListSetAuthorization says system.global-login-items for Docs, But this has worked, nevertheless! But it will fail if the user to work so administrators do not, then you will have to:
AuthorizationItem right [1] = {{ " . System.global: Entry Items ", 0, Zero, 0}}; Authorization rights set offrights = {1, right}; Authorization Reiff AUTH = NULL; AuthorizationCreate (zero, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, & amp; certification); Authority copyright rights (authentication, and set pooh Rights, Keadikarnachci environment, (Keadikarnflag Difoloji | Keofilaijheshnflagintrnaijeshnanumt | Keofisn Fleg Akstenderits), null); It is also advisable in the context of the description.
Comments
Post a Comment