某些图像无法使用 UIImageWriteToSavedPhotosAlbum 保存到相册

Some Image cannot be saved using UIImageWriteToSavedPhotosAlbum to photo album

最近想把url的一些图片保存到用户相册里。 我使用函数UIImageWriteToSavedPhotosAlbumdidFinishSavingWithError回调告诉我结果,我的问题是如果有很多urls的图像,使用这种方式,有些图像总是不能即使已经从 url 下载,也保存到相册中。 我检查了失败保存图片的大小,它是一个png,1290 × 1288,我不知道是不是因为大小太大而无法保存。你们有这样的问题吗?请帮忙~谢谢!

    UIImageWriteToSavedPhotosAlbum(image, self,@selector(image:didFinishSavingWithError:contextInfo:), nil);


    - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
        if (error != nil) {
            isImagesSavedFailed = true;
        }
    }

您可能想尝试将它们一个接一个地编写,而不是并行编写。特别是因为你有很多照片。你让它变成 "too busy." 所以你会想把它们排成队列,而不是一次写完。

您可以在 ios programming: Using threads to add multiple images to library

获得更多详细信息