crapthings opened a new issue #377: cordova-plugin file works on simulator but not real device? URL: https://github.com/apache/cordova-plugin-file/issues/377 i have write an ios share extension, it only works on simulator but not real device. the framework that i use is meteor 1.9 cordova-ios version { "ios": "4.5.5" } cordova-plugin-file is 6.0.2 this is a working demo on simulator https://streamable.com/u784i but on real device, it tells me NOT_FOUND_ERR  ```js import axios from 'axios' const fileReaderSync = file => new Promise(resolve => { console.log('fileReaderSync', file) const reader = new FileReader() reader.onloadend = function () { console.log(this.result) var blob = new Blob([new Uint8Array(this.result)], { type: file.type }) resolve(blob) } reader.readAsArrayBuffer(file) }) const resolveLocalFileSystemURLSync = uri => new Promise(resolve => { console.dir(uri) console.log(uri) window.resolveLocalFileSystemURL(uri, function (fileEntry) { console.log('resolveLocalFileSystemURL', fileEntry) fileEntry.file(resolve) }, function (...args) { console.log(args, uri) }) }) const uploadFiles = async function (urls) { const data = new FormData() if (urls.length > 0) { for (const item of urls) { const file = await resolveLocalFileSystemURLSync(item) const blob = await fileReaderSync(file) data.append('files', blob) } axios({ method: 'post', url: 'http://192.168.50.76:3000/api/upload', data, headers: {'Content-Type': 'multipart/form-data' } }) .then(function (response) { alert(JSON.stringify(response, null, 2)); }) .catch(function (response) { alert(response); }) } } Meteor.isCordova && Meteor.startup(function () { cordova.shareextension && cordova.shareextension.onFiles(async function (urls) { uploadFiles(urls) }, console.log) cordova.openwith && cordova.openwith.init && cordova.openwith.init(function () { cordova.openwith.addHandler(async function (intent) { const urls = _.map(intent.items, 'uri') uploadFiles(urls) }) }, console.log) }) ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
