Created
September 29, 2014 22:25
-
-
Save arohner/566f7811ce30dd295b51 to your computer and use it in GitHub Desktop.
working with CFArray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LaunchAtStartup : NSObject | |
{ | |
public class func enumerateLaunchItems() | |
{ | |
let loginItemsRef = LSSharedFileListCreate(nil, kLSSharedFileListSessionLoginItems.takeUnretainedValue(), nil).takeUnretainedValue() | |
var itemUrl:NSURL? | |
let loginItems:NSArray = LSSharedFileListCopySnapshot(loginItemsRef, nil).takeUnretainedValue() | |
logInfo("loginItem count= \(loginItems.count)") | |
for i in 0..<loginItems.count | |
{ | |
logInfo("loginItem \(i)") | |
if let item = loginItems[i] as? LSSharedFileListItem | |
{ | |
if let itemUrl:Unmanaged<CFURL> = LSSharedFileListItemCopyResolvedURL(item, 0, nil) | |
{ | |
logInfo("launch item: \(itemUrl.takeUnretainedValue())") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment