I am having a problem with cordova-plugin-file-transfer and Xcode simulator running 6 iOs 9. When I attempt to download the a .mp3 file located on an aws s3 bucket that is publicly accessible, I am getting a Code 3 error, which translates to a FileTransferError.CONNECTION_ERR, according to github repo. However, when I run this code on i0s 8.2 iphone 6 works without throwing a connection error…
$ionicPlatform.ready(function() {
if($cordovaDevice.getPlatform() == 'iOS'){
fileDeviceDir = cordova.file.dataDirectory;
}else{
fileDeviceDir = cordova.file.externalRootDirectory;
}
});
function getDownload(){
var targetPath = fileDeviceDir + 'birds.mp3'
var uri = encodeURI('http://www.mbr-pwrc.usgs.gov/id/htmwav/h5810so.mp3'l);
$cordovaFileTransfer.download(uri, targetPath, {}, true)
.then(
function(entry) {
console.log("File Downloaded");
},
function (err) {
console.log('File Download error: ', err);
},
function (progress) {
$timeout(function () {
var percentComplete = (progress.loaded / progress.total) * 100;
console.log('[File Download -progress- percentComplete ="+percentComplete);
})
});
}
my config.xml file
<content src="index.html"/>
<access origin="*"/>
<platform name="ios">
<config-file platform="ios" target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
</config-file>
</platform>
<access origin="https://s3-us-west-2.amazonaws.com/*"/>
<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="AndroidPersistentFileLocation" value="Internal"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
Can any one point me in some direction? I have been searching for the last couple days and I am stuck.
As I have read that some folks, suggest making sure you have the latest cordova-plugins… from my package.json
{
“name”: “cordova-plugin-file-transfer”,
“version”: “1.3.0”,
…
}
Thanks in advance.
