我正在调用以下函数将远程文件保存到相机胶卷。
在我的xcode-Project的库中是CameraRoll项目的链接(node_modues / ...),并将其添加到Link Binary With Libraries ...
doit() {
console.log('STARTING');
CameraRoll.saveToCameraRoll('https://example.com/img_web/pizza.jpg', 'photo').then(function(result) {
console.log('save succeeded ' + result);
alert(result);
}).catch(function(error) {
console.log('save failed ' + error);
alert(error);
});
console.log('FINISHED');
}
我的控制台看起来总是这样:
开始完成
而且相机胶卷中没有新图像...
如果我将URL更改为http://而不是https://并调用该函数,则会收到警报,由于安全性等原因,无法下载该图像。因此在后台发生了一些事情,但是承诺永远不会解决...
最佳答案
要将图像保存到用户胶卷,您需要将此行添加到Info.plist中:
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Description...</string>