Obtain NSURL from UIImagePickerController

后端 未结 1 734
一整个雨季
一整个雨季 2021-01-14 17:18

I\'m attempting to grab the file path of an image selected through an imagePickerController in order to upload the file to Firebase Storage.

func imagePicker         


        
相关标签:
1条回答
  • 2021-01-14 17:47

    I had trouble getting the info[UIImagePickerControllerOriginalImage] to work. I had to do it like this:

    let assets = PHAsset.fetchAssetsWithALAssetURLs([localUrl], options: nil)
    let asset = assets.firstObject
    asset?.requestContentEditingInputWithOptions(nil, completionHandler: { (contentEditingInput, info) in
        let imageFile = contentEditingInput?.fullSizeImageURL
        // now call putFile with imageFile instead of localURL
    
    0 讨论(0)
提交回复
热议问题