我正在使用位置相机。
我在做什么是当点击Capture Image按钮时,我收集字典中的所有位置信息,并进一步将它设置在CFDictionarySetValue中。这是我面临的问题。
的CFDictionarySetValue
格式dict, key, value
如下:如何在swift 3.0中使用UnSafeRawPointer
CFDictionarySetValue((dictionary)CFMutableDictionary!, (key)UnsafeRawPointer!,(value) UnsafeRawPointer!)
和我是字典,键和值如下:
词典:
let mutable : CFMutableDictionary = CFDictionaryCreateMutableCopy(nil, 0, metaDict)
键:
kCGImagePropertyGPSDictionary
值
let gpsDict : NSDictionary = [kCGImagePropertyGPSLatitude: Int(fabs(loc.coordinate.latitude)), kCGImagePropertyGPSLatitudeRef : ((loc.coordinate.latitude >= 0) ? "N" : "S"), kCGImagePropertyGPSLongitude : Int(fabs(loc.coordinate.longitude)),kCGImagePropertyGPSLongitudeRef : ((loc.coordinate.longitude >= 0) ? "E" : "W") , kCGImagePropertyGPSTimeStamp : formatter.string(from: loc.timestamp), kCGImagePropertyGPSAltitude : Int(fabs(loc.altitude))]
它看起来像CFDictionarySetValue(mutable, kCGImagePropertyGPSDictionary, gpsDictionary)
而且我得到上面的行错误说:"Cannot convert value of type NSDictionary to UnSafeRawPointer! for gpsDictionary"
尝试了一些方法,但仍然没有成功。
非常感谢好友,它的工作完美:) – iDeveloper