Webapp caching iOS - ios

I am working on a web application that allows offline usage by caching everything in the manifest file. I am running into a few problems I hope you can help me with.
The problem is that the webapp is very buggy when I add it to homescreen. The problems are:
Sometimes it wont show anything and it tells me to turn on wifi (I test in airplane mode). This seems to be happening randomly. Usually it works if I close the app, connect to the internet, restart the app, and then go to airplane mode.
Sometimes not the entire code is loaded and its all messed up. Rebooting the app always works in this case.
Sometimes there is missing content. First I thought it was simply not done caching everything before I went to airplane mode. But I already experienced a situation where it worked at first, but closing and restarting the app would make the content unavailable.
Its a real pain to debug since it only occurs when adding the webapp to homescreen and you can't really debug in webapp mode (as far as I know, tips welcome!). I have tested offline mode in firefox, chrome and on safari mobile (without adding it to homescreen) and there are no problems there.
By the way, I am testing all this on an iPad 1 with iOS 5 and the webapp is using jquery mobile. iOS 4 has been tested aswell and gave me the same problems, tho it seems to be a little bit better on iOS 5. The webapp always works as it should when connected to the internet so the problem is with the caching.
Any ideas anyone? Or maybe tips on how to debug in webapp mode?

For debugging Web App try this one! iWebInspector You can load Web App into this debugger. And it's free.

Solved the problem. The cache file wasn't formatted properly. I don't know how I could have missed it. Everything is working perfectly now.

Related

iOS universal link does not work on one device (although works on other iOS devices)

I'm facing a strange issue with universal links on iPhone - iOS 12.2.
I'm trying to open the APP using a registered universal link (the same link works on other devices using both - the same and different version of iOS), using identical application (the same version).
What's strange is that I can't even find the option to open the link in a native app when holding the link for a while on this device, although I found it in other devices.
It used to work, but then suddenly stopped to open the APP. I tried rebooting and reinstalling the app.
Did anyone face similar issue? Any suggestion in debugging? I'd really like to avoid factory reset of the phone.
You might be running into either of these two bugs:
https://openradar.appspot.com/45201697
https://openradar.appspot.com/33893852
I just ran into this. Deleting the app, reboot the device, wait an hour or so (unsure of time needed to wait) then reinstall the app. That seems to force it to re-check the AASA.
Seems like there could be a process running after reboot blocking swcd from running.
Have you tried to delete the app and restart the phone to check if this is not a apple-app-site-association problem?
So after upgrading to the newest iOS the problem still remained in Chrome.
I was able to open the contextual menu and open the app through the Open in... item from Safari, and since then it works as expected across all the browsers. This doesn't explain the origin of this issue, but I hope this will help you as well.

Why is Remote Debugging for Safari Mobile so inconsistent?

I've been developing JavaScript for many years with OSX and Mobile Safari, and I've noticed Remote Debugging has ALWAYS been extremely inconsistent.
Currently, I am running Safari 10.0 on El Capitan 10.11.6, and iOS 10.0.2 (the latest), and I'm not getting it to work AT ALL. I actually hadn't attempted to use this feature for several months before recently, so not sure if maybe the feature is just completely broken now.
In the past, if you quit Safari Mobile, and quit Safari (desktop) both, then started them back up, sometimes it would begin working, and then sometimes continue to not work (shows "No Inspectable Applications", or device doesn't show in menu). I am NOT changing any settings between these steps, and I know they are what they should be according to documentation, and tips I've read.
Develop menu is on. Web Inspector is enabled. Fraudulent Website Warnings is off (someone suggested this has something to do with it). iOS is open, and on a web page.
I know other people who've encountered this exact problem again and again. It seems that it is clearly a bug that Apple needs to resolve. I know how to use weinre, and this is a great workaround; however, it is highly irritating to waste my time trying to get this to work several (many) times, and then have to give up, and go set up weinre every time (it happens a lot).
So! I've read through several StackOverflow topics on this (can't find them ATM), but none of them that I've seen specifically address the spottiness of this issue, or how to solve it once and for all.

Cordova app running fine on safari, but crashing when installed as app

I've built a tool for a client, which basically is a tool that displays a number of items and filters them base on the set parameters. This tool started as a web-based project and it runs on all browsers and it should run when opening the html-file from the filebrowser(so when no server is involved).
We tested this on tablets/phones as we knew that it would needed to be ported. So this code is running fine on our ipad3(first gen retina) when we open it up on safari. Now we've been setting this up with cordova. But the moment this loads, we get memory warning, saying that the memory should be cleared etc... the app is running sluggish and some new bugs are showing, probably due to the memory issue's...
I've been looking into profiling/timelineing to find memory-leaks etc, but i can't really find any notable memory-leaks.
Another quirky thing: If we build this app in portrait mode only, the issue's dissapear. But the code that is being executed is exactly the same, we don't do anything differently when in portrait mode besides other styling.
Could be CSS/Mediaqueries/images(png's) be causing these issue's?
If anyone could point me in a direction, that would be great.
If you guys need code/examples/... shout and I will provide.
thx
I found the issue last week. Apparently this was cause by my css. The results were shown as small items in a list of approx 60 items. And they had an on-hover/touch event that would flip the item. But the css that was adding the perspective/backfacing etc was causing memory issue's. I removed them, and everything was working perfectly.
I do still however wonder why this is causing issue's in Cordova, but not in native safari, I would presume that the same app with same code on the same browser would give the same performance .... But apparently there are some differences between a webview and the native safari app?
Unless you installed a WkWebview plugin, Cordova will run your app in a UiWebview which has a lot of performance and memory issues that are not present in WkWebview.
Native safari uses WkWebview under the hood, which explains the performance and stability differences between your Cordova app and Safari.

tvOS Difference Between TestFlight Installed App and Direct USB Run App on AppleTV Hardware

I am working to add a TopShelf implementation to my tvOS app. I am also working to create a Collection View implementation that has a similar functionality from within the app. Both work fine in the simulator on my Mac but don't work when deploying to my Apple TV using TestFlight. I tried using the USB-C cable to try to capture some logs or see what is going on when the UIActivityIndicator just spins. I thought it could be related to trying to download too many images or some other networking issue. I started caching the images and again that works well in the simulator but not on the device.
When I plugged into the device and ran the app it worked as it should, even with a higher number of downloads. I later updated the version via TestFlight and was back at the same position. Right now I am in a position where the app works every time with my own view controller and the TopShelf part, but does not work at all if deployed via TestFlight. I can't get any logs to figure out what is going on because when I connect the USB cable and run the app, it starts working.
Has anyone seen similar behavior or know of any way to troubleshoot what is going on?
I was able to determine there were a couple of things going on. The first was that the simulator was setup for a build configuration of debug. I went in to Edit Scheme and changed the Build Configuration for Run to "Release." This allowed me to recreate on the simulator what I was seeing on the device. It also made it a lot easier to debug as I could easily add logs to track down where the code was hanging.
The root of the problem was that I had a while loop doing nothing while I waited for a network block to update a flag. I've used this hack in other situations and have never run into a problem. If I added one NSLog command to the while loop it would flow through fine, but with nothing in the loop it just hung even though the network dispatch was done downloading data.
To fix this, I read up on using
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER)
which solved my problem (and I'm assuming made my code a lot more reliable too).

Caching web app launched from home screen on iOS

So I've built this web app game with HTML 5 and javascript (mainly jQuery). It's meant to be used on an iPad in a location where there's no wireless internet (a museum).
I am using a cache.manifest file to cache all the files needed for the game to work. And on my desktop using both Chrome and Safari this works great. I can see all the files listed in the application cache in the debugger and the app runs perfectly without internet connection.
Testing it on the iPad's browser also gave good results. It seems to take a bit longer for the iPad to cache all the files but if you give it enough time the app works in safari on iOS in airplane mode as well.
Now here's the problem. When I install the app to the home screen and launch it from there the app doesn't work. Only the first page will run and when I try to go to the next one it'll fail and tell me I need internet. (The second HTML page is loaded after the map appears and you've chosen hall 1)
I've read that it might need to cache all over again if launched from the home screen so I've tried waiting for it to cache and then going to the next page. I've waited for 2-3 minutes yet it still didn't work.
You can find the app here. It's in Dutch so it might be a little confusing.
The manifest file is here.
Any help would be greatly, greatly appreciated! Thanks.
So I figured it out myself.
Turns out it was a real rookie mistake. I had some bad references to the cache.manifest file in some of the pages of the app. And on an iOS device that seems to cause some problems.
Pretty confusing since it worked fine in a regular browser. But lesson learned: iOS is very picky when it comes to little details and you need to have a reference to the manifest-file on every page.

Resources