Created
September 29, 2014 22:25
working with CFArray
This file contains hidden or 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