Opening a local file with InAppBrowser under iOS doesn't work - ios

I am developping a mobile application using Cordova. This application allows users to navigate in a kind of a file manager and allows them to download files. I use the plugin "FileTransfer" to download the file on the user's device and then call the InAppBrowser (version 0.5.2) plugin in order to open it.
While it works really great under Android, I can't say the same under iOS (tested under versions 7 and 8).
This is the line of code I use to open the downloaded file:
window.open(entry.toURL(), "_system");
Under Android, it proposes the user which application he wants to launch to open the file or launches automatically the default application based on the file extension. Under iOS, the file is downloaded and then nothing happens. I have found out I could use the integrated viewer of the InAppBrowser plugin when the user is under iOS. I do that in this way:
if (navigator.userAgent.match(/iPhone|iPod|iPad/))
window.open(entry.toURL(), "_blank");
else
window.open(entry.toURL(), "_system");
With these lines of codes, if the user is under iOS, the integrated viewer is launched and displays the file. The problem is for ZIP files or other files that can't be rendered in the viewer. This one says "Load Error".
I think that if "_system" worked, Safari would be launched and would propose the user how he wants to open the file.
Does anybody have an idea of how I can make "_system" worked in iOS? Is this eventually a known problem (I couldn't find anything related to my problem)?
If this can be relevant to my problem, I use Phonegap Build in order to generate the .ipa file.

On iOS when you use _system, it try to open the url you pass with safari.
As iOS have sandbox access limitations, safari can't open the url because it's inside your app sandbox.
You can try this plugin, it provides an "open with" dialog that will show you the apps that support the type of file you want to open if any available.
https://build.phonegap.com/plugins/1076

Related

Where is the file saved by Cordova File plugin on iOS

I am writing a PDF file on an iPhone running iOS 11, using Cordova File Plugin (in Ionic). The file is created successfully (e.g. in a location like file:///var/mobile/Containers/Data/Application/CDFC4E19-082F-4878-9168-F4A735CDAFEB/Documents or file:///var/mobile/Containers/Data/Application/DA918690-B345-438A-B26D-2EA21D618341/Library/Cloud), but then I can't find the file on the iPhone. I have tried setting the directory to cordova.file.documentsDirectory as well as cordova.file.syncedDataDirectory. When I run the Files app on the iPhone, it shows no recent documents, nor any documents at all. I can't find the file on the phone to view it outside of my app.
Where do I have to save the file to make it findable outside of the app?
I think I've answered this myself. Viewing a PDF that an app created is just not a thing on iOS, as useful as that may be. You can of course do that on Android, which is far more useful. It appears that to view the PDF, you have to use iTunes on an iMac to download the file from the phone. Jumping through those Apple hoops, which I am slowly becoming accustomed to, I was able to view the file in the cordova.file.documentsDirectory location.

Firebase Dynamic Link doesn't redirect to the app when open through Safari

I have added Firebase Dynamic Link in my app, when I open in iPhone link through Google Chrome, it redirects me to the app, but when I'm trying to open app through Safari (I'm opening links through the Notes, not directly from the Safari), it doesn't open the app.
I'm testing on real device, not in simulator.
I have followed official Firebase Dynamic Links Tutorial.
What can be wrong and how is possible to fix that?
My problem was that in Xcode in Capabilities Tab in Associated Domains, in Domains field, I wrote wrong domain, instead of appplinks:app_id.app.goo.gl I wrote: appplinks:app_id.goo.gl, so i missed .app, after app_id, after changing it, it starts work correctly!
add applinks:appName.page.link to associated domain in xcode
https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_associated-domains
you can't open your app through safari , you can open it only by clicking on the link or scanning it(QR) using iPhone camera
One thing we discovered while trying to implement Firebase Dynamic Linking in our app was that the Apple App Association File had to be in the .well_known directory on the web server. Apple's app association documentation states the association file can be in either the root or .well_known:
Place this file either in your site’s .well-known directory, or directly in its root directory.
Setting Up an App's Association File
However, in looking at the web server logs when performing a fresh install of the app on a device, we saw calls being made to the .well_known directory. Once we copied the association file to the .well_known directory, Firebase Dynamic Linking worked as expected.

opening file of registered file type in phonegap / cordova app in iOS

I'd like to open a specific file type (e.g. from email client) in my cordova app on iOS.
Looking at this documentation and this nice tutorial I can learn how can I read the content of the file in iOS app, but I need to manipulate the data in my javascript code.
Can anyone give me a hint how to pass the imported data into cordova app?

Phonegap: initiate download on iOS

Within my app I'm making a zip file (using JSZip) which I need to download (not write to the file system, but actually initiate a download) to the iOS device where the app is hosted. Is it possible to do this?
You might get the effect you're looking for with the InAppBrowser plugin. It should try to open the file with the built-in browser and then it would be up to the user to handle it.
window.open('http://location.to/the.zip', '_system');

PhoneGap Build - BlackBerry link doesn't work

I'm new to mobile development and I've compiled my app through the online PhoneGap Build.
It returns me the links to download all the apps, but the BlackBerry
link doesn't work properly, even if phonegap doesn't return me
any sort of error.
The link is only a single jad file. There are no .jar or .cod files,
and if I try to install it on a blackberry, I can't.
What am I doing wrong?
I don't know much about BlackBerry apps, so maybe I miss something.
Thanks in advance
on your desktop computer, go to https://build.phonegap.com/apps, and click the name of your app (not the d/l links)
it will show a list of qr codes, one for each platform
on your blackberry, open App World, menu, scan a barcode, then scan the qr code and it will download it like a normal app
That same issue would occasionally happen to me as well. I resolved it each time by deleting the app in PhoneGap Build and then resubmitting it and then waiting for the build notification to be shown instead of continually hitting refresh in the browser. It's not scientific but it's what resolved the issue the last 2 times for myself.

Resources