0
我尝试使用此代码,将图像保存在我的iPhone用户的相机胶卷:保存到用户的照片库静静地失败
UIImageWriteToSavedPhotosAlbum(uiImage, nil, nil, nil)
但是,尽管没有崩溃或给了一个错误,这是失败的。我确信图像是一个有效的(而不是无)UIImage,它是。所以然后我试图执行完成处理程序像这样:
UIImageWriteToSavedPhotosAlbum(uiImage, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil)
// ....
@objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
if error != nil {
print("ERROR! ", error!.localizedDescription)
}
}
但是,这仍然没有给我一个错误。最后,我试着在模拟器上运行。这就给了我以下错误:
Connection to assetsd was interrupted or assetsd died
Error! Write failed
是什么导致了这种失败?