How to retrieve PHAsset from UIImagePickerController

前端 未结 4 1038
予麋鹿
予麋鹿 2021-02-07 12:42

I\'m trying to retrieve a PHAsset however PHAsset.fetchAssets(withALAssetURLs:options:) is deprecated from iOS 8 so how can I properly retrieve a PHAsset?

4条回答
  •  孤城傲影
    2021-02-07 13:36

    The PHAsset will not appear in the didFinishPickingMediaWithInfo: info result unless the user has authorized, which did not happen for me just by presenting the picker. I added this in the Coordinator init():

                let status = PHPhotoLibrary.authorizationStatus()
    
                if status == .notDetermined  {
                    PHPhotoLibrary.requestAuthorization({status in
    
                    })
                }
    

提交回复
热议问题