Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios swift 4,使用UIActivityViewController将图像共享到facebook和其他应用程序崩溃_Ios_Swift_Uiactivityviewcontroller - Fatal编程技术网

Ios swift 4,使用UIActivityViewController将图像共享到facebook和其他应用程序崩溃

Ios swift 4,使用UIActivityViewController将图像共享到facebook和其他应用程序崩溃,ios,swift,uiactivityviewcontroller,Ios,Swift,Uiactivityviewcontroller,在我的应用程序中,我尝试将大图像共享到其他应用程序。但当我向facebook发送一张大尺寸图像时,facebook出现了,但它崩溃了。当我将图像调整为小尺寸时,它不会崩溃 我尝试在相机卷中共享大图像,但在相机卷中它不会崩溃,并与原始图像大小共享 使用UIActivityViewController是否有其他方法来执行此操作 var shareImage=UIImage shareImage.removeAll() 询问targetSize:PHImageManagerMaximumSize肯定会

在我的应用程序中,我尝试将大图像共享到其他应用程序。但当我向facebook发送一张大尺寸图像时,facebook出现了,但它崩溃了。当我将图像调整为小尺寸时,它不会崩溃

我尝试在相机卷中共享大图像,但在相机卷中它不会崩溃,并与原始图像大小共享

使用UIActivityViewController是否有其他方法来执行此操作

var shareImage=UIImage shareImage.removeAll()


询问
targetSize:PHImageManagerMaximumSize
肯定会让你得到一张非常大的图像!因此,第一条建议是:不要这样做。
通过使用UIActivityItemProvider子类,您可能能够随时间逐段提供数据。

您是否尝试了PHImageRequestOptions的
networkAccessAllowed
true
?上面写着“一个布尔值,用于指定照片是否可以从iCloud下载请求的图像”。我遇到这样的问题,我的应用程序崩溃了,因为当用户选择或点击时,实际图像不可用。因此,如果这个选项为真,我就能够修复this@PrashantTukadiya我尝试过这个选择,但对我来说是一样的:(
    for i in 0...deletePhotoArray.count - 1 {
        let asset = AlbumModel.allPhotos?.object(at: deletePhotoArray[i])
        let options = PHImageRequestOptions()
        options.version = .current
        options.isSynchronous = true
        options.deliveryMode = .fastFormat
        PHImageManager.default().requestImage(for: asset!, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFit, options: options) { (image, info) in
            shareImage.append(image!)
        }

    }

    let activityViewController = UIActivityViewController(activityItems: shareImage, applicationActivities: nil)
    activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash