Slow webapp load time in Safari iOS 9.1 - ios

Our webapp takes approximately 30 seconds to load for the first time in Safari on iOS 9.1. Most of the visual loading happens in a timely manner, but HTTP requests cannot be handled for about 30 seconds. I have only been able to reproduce this on an iPad by going to the following link: http://tco.ekotrope.com/tco/?deployment=eko-dev&#community/default. And I can only reproduce it once, due to caching. It can be reproduced another time by going to the following link, http://tco.ekotrope.com/tco/?deployment=eko-dev&#community/sunwood-bridgewater.
I have tried investigating looking at the Developer Tools Network Tab while the iPad is plugged into a Macbook, but for some odd reason, the page loads quickly when it's plugged in and I'm looking at the Network Tab.
Any ideas what could be going on or what I could do for further investigation? Thanks!

We were able to resolve the problem on our webapp.
In a nutshell, the problem is with how iOS 9.1 Safari chooses to schedule HTTP connections. For reasons probably related to increasing performance in certain cases has caused certain edge-cases to become problematic. In our case we had several images trying to load at the same time as we needed an XHR to occur. In other browsers like desktop Chrome this was not an issue, but iOS 9.1 Safari chokes when it tries to do all of that at once. Our solution was to have the images that trigger the problem load one after the other rather than all at the same time. This spread things out enough that things operated smoothly.

Related

iPhone restarts after API call

I am facing a very weird issue: my iPhone is restarting.
This issue occurs in a particular scenario only.
Step 1: I have a sync process in which I'm loading data for the whole app. So I'm basically doing a heavy API call by uploading 4-5 camera captured images and syncing the app data;
Step 2: After syncing, I'm pressing the iPhone home button to make the app go in background;
Step 3: I'm locking the iPhone screen(by using side button);
After a few seconds I'm seeing the apple logo and the phone seems to restart. This is not replicating when the app is connected in debug mode. I checked the debug navigator app is using only 125 MB of memory, disk and network values is 0%. Energy Impact is showing high, I'm not sure this is due to high energy impact. I'm facing this issue only on iOS 12.4.
The fact that the phone (or possibly just springboard) restarts, and not just your application means this is Apple's bug. You're not supposed to be able to crash iOS even if you try.
Finding a likely cause will be hard since the system is not behaving the way it's supposed to. The device's logs may have more information from things other than your app. This may be a system API breaking due to any number of actions from your application.
Often with this kind of thing the next OS version will fix it, but if that's not the case or it's important to track down I would try removing ways you're interaction with the system (background APIs, notifications, etc.) and see if anything fixes the issue.
If you find the problem, you may even be doing things the "correct" way according to the documentation and have to find a workaround. If you have the time you can submit a bug to Apple so the underlying issue has a better chance of being fixed.
It seems when your app is in the background and phone locked, Automatic Reference Counting (ARC) closes some connection or deallocates a resource that makes the iPhone restart. Are you closing all connections and removing all references once the upload is complete?
Phones do not spontaneously restart just because of an app’s actions. You’re having an issue with your phone, not with a program. You need to repair or replace the phone.

React-native fetch extremely slow on wifi compared to cellular. Both in dev and production, irrespective of running/not debugger

I am facing extremely slow fetch/network on a RN 0.57 app with wifi (this has been the case since 0.4x, so i think it is version independent)
I am fetching some json or downloading images with RNFS.
It happens on ios.
It happens on dev and release versions both.
It happens both when debugger is on/off.
It does not happen on cellular.
It happens both when using fetch, xmlhttprequest, (RNFS, i don't what that one uses)
It always happens on a wifi connection. (tried several networks/places)
The request takes 10-15seconds on wifi vs sub 1 second on cellular.
While not being sure, the delay partly comes from starting of the request, several seconds pass until i get first event from xmlhttp.
I am stuck and cannot find a way around this.
Issue fixed after moving from ios 11 to 12

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.

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