cfdictionary

CFDictionary get Value for Key in Swift3

我与影子孤独终老i 提交于 2019-12-31 03:46:45
问题 I've a problem with accessing a specific (or any) key in a CFDictionary. Honestly I don't really get the way you need to do this in Swift and I think it's overly complicated... My Code: if let session = DASessionCreate(kCFAllocatorDefault) { let mountedVolumes = FileManager.default.mountedVolumeURLs(includingResourceValuesForKeys: [], options: [])! for volume in mountedVolumes { if let disk = DADiskCreateFromVolumePath(kCFAllocatorDefault, session, volume as CFURL) { let diskinfo =

CFDictionary get Value for Key in Swift3

匆匆过客 提交于 2019-12-31 03:46:09
问题 I've a problem with accessing a specific (or any) key in a CFDictionary. Honestly I don't really get the way you need to do this in Swift and I think it's overly complicated... My Code: if let session = DASessionCreate(kCFAllocatorDefault) { let mountedVolumes = FileManager.default.mountedVolumeURLs(includingResourceValuesForKeys: [], options: [])! for volume in mountedVolumes { if let disk = DADiskCreateFromVolumePath(kCFAllocatorDefault, session, volume as CFURL) { let diskinfo =

How to create a CFDictionary in an OS X target?

▼魔方 西西 提交于 2019-12-10 09:26:29
问题 According to documentation CFDictionaryCreate is used to instantiate CFDictionary in swift . func CFDictionaryCreate(_ allocator: CFAllocator!, _ keys: UnsafeMutablePointer<UnsafePointer<Void>>, _ values: UnsafeMutablePointer<UnsafePointer<Void>>, _ numValues: CFIndex, _ keyCallBacks: UnsafePointer<CFDictionaryKeyCallBacks>, _ valueCallBacks: UnsafePointer<CFDictionaryValueCallBacks>) -> CFDictionary! How can I create the keys and values arguments? So far I've tried to use swift's String type

CFDictionaryRef issues in Swift

牧云@^-^@ 提交于 2019-12-09 22:41:33
问题 I'm converting some of my older Objective-C code to Swift so I can move away from some deprecated methods but I keep getting a crash and so far I can't seem to figure out what's causing it. I'm getting a private key from a P12 Certificate and this method seems to work fine up until I get to the part where I actually need to get the dictionary from the CFArray, and even though the array has values in it the app keeps crashing. Here's the code that I have : func privateKeyFromCertificate

How to create a CFDictionary in an OS X target?

风格不统一 提交于 2019-12-05 13:45:20
According to documentation CFDictionaryCreate is used to instantiate CFDictionary in swift . func CFDictionaryCreate(_ allocator: CFAllocator!, _ keys: UnsafeMutablePointer<UnsafePointer<Void>>, _ values: UnsafeMutablePointer<UnsafePointer<Void>>, _ numValues: CFIndex, _ keyCallBacks: UnsafePointer<CFDictionaryKeyCallBacks>, _ valueCallBacks: UnsafePointer<CFDictionaryValueCallBacks>) -> CFDictionary! How can I create the keys and values arguments? So far I've tried to use swift's String type hoping it would be automatically converted to appropriate types: import Foundation var keys : [String]

CFDictionaryRef issues in Swift

痴心易碎 提交于 2019-12-04 17:09:54
I'm converting some of my older Objective-C code to Swift so I can move away from some deprecated methods but I keep getting a crash and so far I can't seem to figure out what's causing it. I'm getting a private key from a P12 Certificate and this method seems to work fine up until I get to the part where I actually need to get the dictionary from the CFArray, and even though the array has values in it the app keeps crashing. Here's the code that I have : func privateKeyFromCertificate(p12Name: String, withPassword password: String) -> SecKeyRef { let resourcePath: String = NSBundle.mainBundle