iOS/Safari: "Back" button on FileDownload screen sometimes missing - ios

Currently I'm facing a weird problem where I don't have any clue (because of this sorry for the very vague question). I've developed an Angular Web Application, that offers a file download. Now the weird part:
When testing on iOS (13.3, iPad, iPhone), basically everything is working. Then I did some variation of my test: I used the "Add to home screen" feature, where the web-app basically pretends to be a PWA, and iOS/Safari is opened without any browser UI.
In this mode, Safari handles file downloads a bit differently: When downloading a file, it shows a full-screen Overlay with the file name and some options, and some "Back/Done" button in the top bar (see screenshot below, where I download a test file "image.jpg").
The problem is that on some iOS devices on some test servers, exactly this button is missing in Safari, everything else is working.
Any idea what could trigger this behavior in iOS/Safari?

iOS PWAs have been really buggy with small issues like this because of certain new iOS features such as the Safari Download Manager in browser so Apple either hasn't realized or decided how they want to handle these bugs in PWAs.
I'd suggest to try out some different options to download your test files: https://forums.developer.apple.com/thread/95911

Related

Universal links (Deep linking) not working on iPhone but works on iPad

I am trying to build deep linking feature into my app. I did all the necessary set up for deep linking to work like, enabling associated domains in my app, adding apple-app-site-association to the root directory of my server, and I am serving a valid apple-app-site-association over https, I also validated my apple-app-site-association using this tool Validate your apple-app-site-association.
After doing everything right, I tested the deep linking feature on my iPad and it worked as expected. But when I tried to do the same on my iPhone it doesn't work, it always took me to safari. I tried it on 6s device, I reinstalled the app, I cleared Safari website data & cleared the history. Also updated the iPhone & iPad to iOS 9.3.5. The updating the OS didn't change a thing.
iPad still continue to work with deeplink URLs just like it did while it was on 9.3.4. iPhone still opened the link in safari.
Please give me some pointers on how to workaround this issue, I think this might be an apple bug but again I don't understand how it can work on iPad which is running same software as iPhone. Any help or guidelines is much appreciated.
Thanks.
I was able to fix this issue and this is one of the annoying issue that I have come across, because it doesn't say what is going wrong.
Fix: Whenever the iOS opens your link in safari, you need to pull down the webpage in safari and there you'll see a banner saying that, open it in the app. Once you click on that banner your future links will start opening the app instead of opening it in the safari browser.
There was no error whatsoever and there was no indication why the link was getting opened I am pretty sure that, iOS didn't download the apple-app-site-association whenever I installed the app.
Also note that the banner in the webpage will not be visible whenever your link opens up in safari, you need to pull down the webpage and then the banner will become visible and if you click on open in app banner, it will start opening the links in app.
If in future if you select to view the link in safari by clicking on context menu which appears on right hand side of the status bar, which will be saying "Open in [your app name]" in safari, the links in future will open in safari instead of app, and again if the banner open in app isn't visible, you have to pull down the webpage to see that banner.
HTH.
In iOS 13, similar problem of direct links not opening the app instead it open the safari website directly.
Fixed by updated the below safari setting...
Settings > Safari > Request Desktop Website > All websites > Switch Off
I was facing the same issue in iOS 12, on one device the link redirected to my app and on another device it was always redirecting to Safari and pressing the link on the Notes app was only allowing me to open it on Safari.
What I believe happened was that I pasted the URL in the browser and clicked Go, as I thought it would redirect to my app. No matter what I did ( reinstalling the app, restarting the device, ... ) the results were always the same, redirecting to Safari.
What helped me was deleting the cached data for my domain ( Settings -> Safari -> Advanced -> Website Data -> Swipe and delete the data for your domain ).
After that, everything started working.
I believe this is a bug with iOS Simulator,
In my case it was occurred when I entered an invalid address (with multiple spaces) for example:
Valid One: myApp://order/10003101
Invalid One: myApp://order/1003131
It stopped working even with Valid One and the solution was to clear Safari Website Data:
Go to Settings/Safari -> Clear History and Webstie Data
Device: iPhone 12 Pro Max
iOS: 14.5
Xcode: 12.5

What could cause iOS Universal Links to stop working?

I had Universal Links working on my iOS 9 app. If I clicked on a UL from an email or text message, it would launch my app as expected.
Then I added a QR Code Reader and used openURL() open the UL embedded in the QR Code from within my app (which was supposed to be handled by the app itself).
On one test run, the URL embedded in the QR code was malformed: it had a CR/LF at the end of it, and when the app tried to open it, it crashed (I do not have the crash log/trace unfortunately).
As I researched the crash I realized that openURL() is not designed to work with UL, so I fixed the code to have my app handle the URL differently, but now none of the ULs work with my app anymore: what used to work from an email or text message doesn't anymore (it launches Safari instead of my app).
I install my app via TestFlight and I can see from my backend that the apple-app-site-association file is being pulled, but it still won't work.
Important data (that's how I know the problem is with the state on that specific phone): the same app on a different phone opens ULs correctly.
It's as if the one bug I ran into put the phone in a state that will always launch Safari for those URLs no matter what.
It is the only phone that exhibits this problem.
What I tried without success:
uninstalling the app completely
reboot
Not sure what to try next. Thanks in advance for the help.
You probably clicked on the link in the top right corner of the status bar to open one of your ULs in Safari. After that all subsequent ULs will open in Safari.
In Safari, pull down the page until you see the Smart-App-Banner at the top. Then click on 'Open' and ULs should work again.

How to create a HTML link to a build.phonegap app?

I have run into several problems with iOS development through phonegap recently, and unusually people around here have been unable to discuss these issues and even together we have (for the first time I have ever seen) not had a single comment or answer for these topics...
See https://stackoverflow.com/questions/14707936/make-a-page-that-redirects-back-to-ios-phonegap-app and iOS broswer data -> Cache & Cookie for Phonegap App / Session?...
However, I have found "solutions" to get around these, but its by no means answers to the issues in question which are still outstanding... just simply doing it a completely different way.
However, despite loosing web-view in phonegap, in an attempt to get around https://stackoverflow.com/questions/14707936/make-a-page-that-redirects-back-to-ios-phonegap-app I now have some issue that are outstanding...
I need to be able to navigate back to my App from the web-system !!!
However, I have no idea how. I have read info on creating URL Schema, but I am not sure if this is even possible through build.phonegap at all... and it seems faily complicated. Does anybody know of a way for iOS safari to do one of two things
Either
Open the app that is running in the background
or
close the current browser tab and navigate back to the app in the background.
The closing tab idea would be good, but not essential
Look forward to everyone thoughts and opinions on this one...
Henry
You can create an url scheme for any application you make yourself.
See tutorial here
It's not as terribly complicated as one would think, and the required objective-c code is minimal.
Once you have done this, you can use your own url scheme to launch your phonegap application from safari with a hyperlink.
This would not close the tab (you could do this with javascript if you wanted to)
but does put safari in the background, and opens your phonegap app.
(whether it is already running in the background or not)
It is even possible to pass data to the app using your url scheme.
It is not currently possible using PhoneGap Build in 2.2 and previous. Potentially a feature top be released in newer versions of Cordova/Phonegap

Anyone experience caching issues with web apps ran in full-screen mode iOS/Mobile Safari?

I'm having a very strange issue with my web app (which is ran in full-screen mode from the home screen) and Mobile Safari. Usually, as I develop, I edit the files with the changes that I want to make and then I re-launch the app from the homescreen. As per iOS design, the web app will refresh and reload the site.
However, in some odd but frequent situations, when I launch the application I get a cached older version of the app. If I navigate to the app through Mobile Safari (not from home screen) then everything looks great.
I've added meta no cache tags all over the space and even attempted to thwart the cache by adding ?query strings to .css files, etc, but for some odd reason when a cached version decides it wants to display - it will display, no matter what. Clearing cache and data from the settings menu and then relaunching will only sometimes fix the problem.
Anyone else run into this issue? If so, how did you fix it? Is it a known iOS bug? I'm thinking about adding some onLoad code to check if the application is running in full screen mode and then explicitly force a refresh.
Please help - this is extremely annoying and frustrating!
Rich
In my own testing I also found that applications run from the "Home Screen" on iOS won't properly refresh their CSS and JS files. This appears to be an ongoing problem. The only solution that worked for me was to:
Change the device date forward by 2 days or so..
Reload the app from the Home Screen..
Reset the date.
I also tried deleting and recreating the icon from the home screen and clearing the cache in Safari.
"Happily" you are not the only one seeing this problem.
https://discussions.apple.com/thread/3385843?start=90&tstart=0
Incase anyone asks. There were no manifest files involved in my testing.
iPad 2 with IOS 5.1.1.
Enable Debug console from "Settings>Safari>advance" and see if you've any errors there.
Most probably you may have an 'Invalid MIME type", Manifest Parsing or Resource Fetch Failure Error.
Fix them (this link might help in fixing those http://www.fuckyeahtml5.com/2011/06/debugging-html5s-offline-web-apps/).

iOS: Did Apple disable HTML5 offline capability for web apps saved to the home screen?

I've been doing lots of work in getting a few web apps to work offline on iOS using the HTML5 manifest. I've ran across the typical problems everyone else has and fixed them and everything seems to be working fine—except in the case where I save the web app to the desktop on my iPhone 4.
If I do this and then enable airplane mode, I get the following alert when trying to access the app via the home screen: "your-app-name could not be opened because its not connected to the internet." Accessing the app via Safari browser works fine while offline.
If anyone knows if this is an error on my part, or even the slim possibility of a work around, do tell.
Even downloading the new Financial Times web app (very well done with extensive localStorage support) results in an error when accessing it offline from the home screen.
Technical specs: Running iPhone 4 with iOS 4.3.3 (but also saw the issue in 4.3.2)
After reading the comments (especially Rowan's) I ran more tests and found the answer:
No, Apple did not disable HTML5 offline capability for web apps saved to the home screen, it works - for the most part. There is a bug that will make it not work. It doesn't seem to have anything to do with your manifest setup (unless perhaps it downloaded a bad manifest or incomplete manifest at one point.) We don't know how widespread it is but the fix is to clear your Mobile Safari Cache.
Here's the steps:
Close the web app (make sure its not sticking around in the background).
Cleared Mobile Safari cache: Settings > Safari > Clear Cache
Reopened the app (for caching).
Close the web app again (make sure its not sticking around in the background).
Enabled "Airplane Mode": Settings > Airplane Mode
Reopened the app.
It should now work offline. If it doesn't then its probably a separate manifest issue in your app. Looks like a weird bug with the browser cache - or perhaps the cache was completely full? Who knows, but that's the answer. Thanks guys.
iOS seems to be very sensitive to load issues when offline.
I was getting your "could not be opened" error when offline on a page I was working on. The problem turned out to be that the page created an iframe pointing to a site that didn't have an AppCache. Removing those iframes fixed the issue.
In my case, I handled it using window.navigator.standalone which tells you whether you're running in an iOS homescreen app. The code looked like this:
if (!navigator.standalone) insertFrames();
add this to your html:
https://web.archive.org/web/20170201180939/https://jonathanstark.com/blog/debugging-html-5-offline-application-cache?filename=2009/09/27/debugging-html-5-offline-application-cache/
I found it massively useful - even though I've created my manifest file and compared it to other people's manifests this JavaScript debugging script gave me the clue I would have never found otherwise. I apparently had syntax error in my manifest ... long story short I had to remove everything and add the paths to each file/image one by one. The end result was the same however it worked... how weird!!! does whitespace / comments affect the syntax of the file?

Resources