这是我获得pd.DataFrame(sur_perimetre[col].value_counts()).reset_index()[:5]
的方式:
NSURL
正在使用func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let referenceUrl = info[UIImagePickerControllerReferenceURL] as? NSURL {
//access the file name
}
}
:
ALAssetsLibrary
但自iOS 9以来已被弃用。
答案 0 :(得分:2)
最简单的答案:
if let asset = PHAsset.fetchAssetsWithALAssetURLs([referenceUrl], options: nil).firstObject as? PHAsset {
PHImageManager.defaultManager().requestImageDataForAsset(asset, options: nil, resultHandler: { _, _, _, info in
if let fileName = (info?["PHImageFileURLKey"] as? NSURL)?.lastPathComponent {
//do sth with file name
}
})
}