美文网首页
ios 从相册想着图片如果是iCloud的云图片

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

作者: 思绪飘零ing | 来源:发表于2018-07-24 11:58 被阅读0次

    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的云图片

          本文链接:https://www.haomeiwen.com/subject/anuemftx.html