Cordova截图插件:不';我不能在iOS上工作
我正在使用Cordova 6.4.0和插件com.darktalker.Cordova.screenshot 0.1.5“screenshot”。 这是我的简单代码Cordova截图插件:不';我不能在iOS上工作,ios,cordova,Ios,Cordova,我正在使用Cordova 6.4.0和插件com.darktalker.Cordova.screenshot 0.1.5“screenshot”。 这是我的简单代码 navigator.screenshot.save(function(error, res) { if(error) {
navigator.screenshot.save(function(error, res)
{
if(error)
{
alert(error);
}
else
{
alert(res.filePath); //just to see the path
}
}, 'jpg');
代码在android上运行:截图被截取并保存,所以我可以使用它。但是,它在iOS上不起作用:我找不到屏幕截图。
如何解决问题?编辑2: 要将图像保存到照片库,请使用此插件: 使用插件和截图插件保存图像
navigator.screenshot.URI(function(error,res){
if(error){
console.error(error);
}else{
var params = {data: res, prefix: 'myPrefix_', format: 'JPG', quality: 80, mediaScanner: true};
window.imageSaver.saveBase64Image(params, function (filePath) {
console.log('File saved on ' + filePath);
},
function (msg) {
console.error(msg);
}
);
}
}, 'jpg', 50);
编辑:
我想我没有完全理解这个问题
我认为你将无法在iOS上导航到该目录。相反,您需要将数据作为URI获取,并使用类似相机插件的东西将其存储在照片库中
这是如果您试图查看图像?我认为该插件的设计目的是返回一个屏幕截图并将其保存在应用程序的临时目录中。显示图像或将其存储在其他位置取决于您
原始答案
我认为问题在于iOS只使用jpg,不需要“jpg”参数。尝试将代码更改为
navigator.screenshot.save(function(error, res)
{
if(error)
{
alert(error);
}
else
{
alert(res.filePath); //just to see the path
}
});
此外,在IOS上,获得的路径是:/private/var/mobile/Containers/Data/Application/some code(25BF5D81-…)/tmp/“screenshotname”。jpgSorry。问题是,当我试图在图库中查找截图时,我找不到它。那么,应用程序将照片保存在iOS上的什么位置?如何使用该屏幕截图?我添加了一些关于使用插件保存的信息。