-1

I finished the downloading part in ios.

But for opening the download files I used file opener plugin in android, which is working well in android. But for ios file opener plugin is not working.

Can any one help me out? Thanks in advance :).

Krishna
  • 83
  • 9
  • need more info on error and link to ios plugin you are using ,also iOS version. – NiRUS Dec 11 '15 at 06:25
  • which plugin you used. Try with [this one](https://github.com/pwlin/cordova-plugin-file-opener2) – manukv Dec 11 '15 at 06:28
  • com.phonegap.fileopener this one i have used. The following code i have used to open the downloaded files in android window.plugins.fileOpener.open(decodeURI(entry.toURL())); – Krishna Dec 11 '15 at 06:33
  • @Nirus This same piece of code is working in android(window.plugins.fileOpener.open(decodeURI(entry.toURL()))). But I am testing myapp in iphone 4s and 5s. I don't know how to debug in iphone. Is there any way to debug the code in web browser like as chrome for android. – Krishna Dec 11 '15 at 06:38
  • @manukv I am testing on device, how to see the errors on device. I am new to ios. – Krishna Dec 11 '15 at 06:40
  • Think you are using the plugin "markeeftb/FileOpener", and this supports android only. try this [plugin](https://github.com/pwlin/cordova-plugin-file-opener2) – manukv Dec 11 '15 at 06:40
  • You can use Safari to remote debug on iOS: http://phonegap-tips.com/articles/debugging-ios-phonegap-apps-with-safaris-web-inspector.html – daserge Dec 11 '15 at 06:42
  • @daserge but safari debugging is enabled for iphone 6 onwards. – Krishna Dec 11 '15 at 06:43
  • @manukv here is the plugin info – Krishna Dec 11 '15 at 06:44
  • You can use cordova-weinre for debugging. check this [answer](http://stackoverflow.com/questions/21332853/is-there-a-real-solution-to-debug-cordova-apps) – manukv Dec 11 '15 at 06:46
  • Thank You manukv for your help :). – Krishna Dec 11 '15 at 06:48
  • @Krishna, not iPhone 6, but iOS 6 is required. – daserge Dec 11 '15 at 06:50
  • thanks your help. Now I will try to debug my app on iphone device - @daserge – Krishna Dec 11 '15 at 07:00

1 Answers1

2

Hope you are using an old one, Try fileopener2

install plugin through cli

cordova plugin add cordova-plugin-file-opener2

and usage is

cordova.plugins.fileOpener2.open(
    '/sdcard/Download/mypdf.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
    'application/pdf', 
    { 
        error : function(e) { 
            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
        },
        success : function () {
            console.log('file opened successfully');                
        }
    }
);

UPDATE

you can specify the MIME-type (second field) from the list of MIME types. These are the list of known MIME-types

manukv
  • 2,031
  • 18
  • 30