gpt4 book ai didi

iphone - 从iOS Phonegap中的URL下载图像

转载 作者:行者123 更新时间:2023-12-01 16:49:21 29 4
gpt4 key购买 nike

我正在尝试从网址下载图片,但在ios中未成功,但在android中成功完成了。

var url = "http://www.intelligrape.com/images/logo.png"; // image url
try{
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
var imagePath = fs.root.fullPath + "/logo.png"; // full file path
var fileTransfer = new FileTransfer();
fileTransfer.download(url, imagePath, function (entry) {
alert(entry.fullPath); // entry is fileEntry object
}, function (error) {
alert("Some error");
});
})
}catch(e){
alert(e);
}

我收到未定义 LocalFileSystem的错误。我与此包括cordova2.5.0.js。

我的Config.xml在下面。
<?xml version="1.0" encoding="UTF-8"?>
<cordova>
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="true" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="cloud" />

<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="Accelerometer" value="CDVAccelerometer" />
<plugin name="Camera" value="CDVCamera" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Contacts" value="CDVContacts" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
<plugin name="FileTransfer" value="CDVFileTransfer" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="Notification" value="CDVNotification" />
<plugin name="Media" value="CDVSound" />
<plugin name="Capture" value="CDVCapture" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Battery" value="CDVBattery" />
<plugin name="Globalization" value="CDVGlobalization" />
<plugin name="InAppBrowser" value="CDVInAppBrowser" />
</plugins>

<access origin="*" />
</cordova>

最佳答案

请在所有自定义js文件之前添加cordova2.5.0.js文件。您可能在代码之后包含了它

关于iphone - 从iOS Phonegap中的URL下载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17417185/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com