本文介绍了如何提取PHAsset的Location属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Xcode表示PHAsset没有'location'成员.
Swift有什么补救方法?
Xcode says that PHAsset doesn't have the 'location' member.
What's the remedy for Swift?
推荐答案
简短的答案:您可能忘记了导入CoreLocation;
Short answer: you might have forgotten to import CoreLocation;
import Photos
import CoreLocation
let asset: AnyObject? = nil
if let asset = asset as? PHAsset {
let location = asset.location
}
当我删除CoreLocation导入时,我可以复制您的错误.
When I remove the CoreLocation import, I can replicate your error.
这篇关于如何提取PHAsset的Location属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!