ios 从相册想着图片如果是iCloud的云图片

funcqb_imagePickerController(_imagePickerController:QBImagePickerController!, didFinishPickingAssets assets: [Any]!) {

      //  Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

        letmanager =PHImageManager()

        forassetinassets {

            let phi = PHImageRequestOptions()

            phi.isSynchronous=true

            phi.isNetworkAccessAllowed = true

            vararrImg = [UIImage]()


            manager.requestImageData(for: assetas!PHAsset, options: phi, resultHandler: { (data, dataUTI, orientation, info) ->Voidin

                letimg =UIImage(data: data!)

                arrImg.append(img!)

            })

            EkoQiNiu.onUploadImgs(arrImg,type:self.type!,onLoaded: { (urls) ->Voidin

                //                print("urls",urls)

                foriin0..

                    self.arrImgUpLoad[self.arrImgUrl.count].img.image= arrImg[i]

                    self.arrImgUrl.append(urls[i])

                    EkoCache.onCacheImage(urls[i], img: arrImg[i])

                }

                self.eData.pics=self.arrImgUrl

                self.onSetWaitUploadImg()

                self.seletedImg=nil

            })


        }


        imagePickerController.dismiss(animated:true, completion:nil)

        ifself.delegate?.takePictureSuccess?() !=nil{

            self.delegate?.takePictureSuccess!();

        }

    }


这里面  解决 从iCloud 获取图片 data 为nil 的代码是 

    phi.isNetworkAccessAllowed = true

你可能感兴趣的:(ios 从相册想着图片如果是iCloud的云图片)