Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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 从我的UIView截图并将其另存为图像或PDF Swift 5、Xcode 13、iPad_Ios_Swift_Ipad_Screenshot_Photo Gallery - Fatal编程技术网

Ios 从我的UIView截图并将其另存为图像或PDF Swift 5、Xcode 13、iPad

Ios 从我的UIView截图并将其另存为图像或PDF Swift 5、Xcode 13、iPad,ios,swift,ipad,screenshot,photo-gallery,Ios,Swift,Ipad,Screenshot,Photo Gallery,可在此处找到: 我想使用此代码从我的viewcontroller获取图像。此后,我想保存图像到我的照片库打印和邮寄 仅当我在返回图像的倒数第二行添加此代码时!: UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) ,我得到“信号SIGABRT”错误 在我的info.plist中,我试图添加:隐私-照片库使用说明,但没有任何价值。 有人能帮我找出哪里出了问题吗? 另一个选择是将截图保存为pdf格式,保存在任何文件夹中,以便稍后查找并发送和

可在此处找到:

我想使用此代码从我的viewcontroller获取图像。此后,我想保存图像到我的照片库打印和邮寄

仅当我在返回图像的倒数第二行添加此代码时!:

 UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
,我得到“信号SIGABRT”错误

在我的info.plist中,我试图添加:隐私-照片库使用说明,但没有任何价值。 有人能帮我找出哪里出了问题吗? 另一个选择是将截图保存为pdf格式,保存在任何文件夹中,以便稍后查找并发送和打印。
谢谢您的提示。

使用
NSPhotoLibraryAddUsageDescription
()

NSPhotoLibraryAddUsageDescription 一条消息,告诉用户为什么应用程序请求对用户照片库进行只写访问

重要的

如果您的应用程序使用对用户照片库具有写访问权限的API,则需要此密钥

您是wright,thx很多:NSPhotoLibraryAddUsageDescription消息请求能够添加到照片库NSPhotoLibraryUsageDescription消息请求能够访问照片库
 UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)