我想從UIImagepickercontroller
獲取文件名。我不想使用ALAssetLibrary,因爲它在iOS9中已被廢棄。請告訴如何使用它。我已經使用了下面的代碼,但它總是爲每個文件返回我的imagename作爲Asset.jpg
。如何使用Asset Library在uiimagepickercontroller中獲取文件名?
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let originalImage = (info[UIImagePickerControllerOriginalImage] as? UIImage)!
let url = info[UIImagePickerControllerReferenceURL] as! NSURL
imageData = UIImageJPEGRepresentation(originalImage, 100) as NSData?
let data = UploadData()
data.fileName = url.lastPathComponent
picker.dismiss(animated: true, completion: nil)
}
* PHAsset.fetchAssets(withALAssetURLs:[imageURL],options:nil)*已在iOS 11中棄用。您是否有替換品? –
此代碼不適用於ios 11.0.3。任何解決方案 –