I have multiple webviews on one page, when app loads, the main page stucks for almost 8-10 seconds, I am guesing tht is the time taken by all webviews to load respective websites, why does Ui stucks, how can I make loading of webviews asyncronous so that Ui remains responsive?
you can try https://learn.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/web-view#threading-behavior and move the processing to a different thread or process it did help me a bit but not much https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webviewexecutionmode?view=winrt-19041
Related
I have read a few posts on this topic about making the launch screen last longer, but I want to make it shorter.
Currently my launch screen takes 4 seconds before loading the login screen, and the app is not even close to being finished yet. Does that mean the launch screen could take longer to load once the app is finished?
Is there any way to make the launch screen appear for 2 seconds?
Xcode, Swift. backend in PHP.
The launch screen loading time depends on how "long" it takes your initial view controller to be prepared.
So, if you want it to "load faster" make your initial view controller more lightweight, do this by:
Reducing the number of interface elements being shown
Do not perform that many operations inside the "view did load" method.
Other than this, theres really not much you can do to control the time.
There isn't really a straightforward way of making the launch screen last shorter, because it depends on how long it takes for the necessities of your app to load.
Remember, the shorter the launch screen, the better, so the users of your app won't think that your app is taking a lot of time to boot up.
I am developing a product in which we have to render a web page. This particular web page can invoke our objective c methods. This is implemented using EasyJSWebview. Once the web page is loaded that has a timer running there. Web page is shown properly till the timer reaches the desintaiton time. Once that timer is reached, that page is reloaded with some event content. There the problem is occurred. The problem is that the page starts to load, activity indicator is shown but it does not close of finishing delegate method is not called. So, Activity Indicator is shown forever. But, Page is not loaded yet. But, If I navigate to the side menu and reload the page manually, That event web page is loaded properly and If I press home button when it reloads with the activity indicator, the app closes and I open it again, that activity indicator is hidden and the page is not loaded yet.
There are lots of hits to server during this event. It occurs only in live. But, If I test it in our development server with many hits with the help of JMeter, our application works properly.
So, It occurs only in live. Our live deployment consists of many replica's of servers. Can it occur due to this too?.
I am not able to find any solution for this. Please let me know if you have any solution for this.
Thanks in advance.
This was just an internet issue. The present code works properly.
My iOS app launch screen takes about 3 - 5 seconds. I have a map that will load after the launch screen. My users have to wait for the launch screen to load and then wait another 3 seconds for the map to load.
Is there a way to minimize launch screen time?
Basically this delay means that you are doing something very wrong during launch. Your job is to launch immediately. Indeed, the WatchDog app will kill you dead if you don't.
There are excellent WWDC videos on this topic, and you should watch them. But in general there are two ways to go wrong:
You must do nothing time-consuming on the main thread. If you have a time-consuming thing to do, like loading your map or networking, you must do that on a background thread. You need to get out of the way so that the runtime can launch your app now.
Just the other way around, you must not touch the interface on any other thread but the main thread. Doing this wrong causes just the kind of delay you are reporting. Do your work on a background thread, but then get back on the main thread to talk to your views, view controllers, etc.
Finally, I should point out that you might be able to get some idea what you're doing wrong by using Instruments. Unfortunately it works rather badly against app launch, but it can be worth a try. Above all, watch those videos!
My company uses a UIWebView to display ads. The issue I'm having is that initializing a UIWebView appears to be expensive; profiling with Time Profiler shows [UIWebView alloc] initWithFrame:CGRectMake(0,0,500,500)] to take 31–40ms. This is enough to cause noticeable frame drops in games running at 60 FPS.
Is there a way to workaround this slow initialization time? My current ideas are to create a UIWebView when the app launches (but before gameplay has started), and reuse that (potentially creating a pool of them to reuse, like how UITableViewCell works) or to try and see if WKWebView has better performance.
Here are my findings:
WKWebView does not initialize any faster. Creating WKWebViews took a similar amount of time as creating UIWebViews (in the 1 test I did, it took 46ms to create two WKWebViews.
The very first web view created takes significantly longer to create than subsequent web views. The first one takes 31–42 ms; subsequent ones take ~11ms to create. The good news here is that creating the first web view when e.g. the app launches allows future webviews to be created more cheaply, avoiding a 40ms hit while the game is running.
Creating a pool of UIWebViews was a good solution for my use case. By creating the webviews at app launch and then reusing them, I avoid causing a frame drop while the game is running.
There is not much difference in the responsiveness between UIWebView and WKWebView because WKWebView has been introduced for a consistency matter between iOS and OSX. The underlying engine is Webkit in either way and it requires a lot of initialization.
The best solution I've found recent during years has been fading a WebView starting from a view with 0.1 alpha in which the url was loaded. Be careful to not start from 0.0 and do not have your webview detached from main view hierarchy because your url would not be loaded.
When didFinishLoading is called then you can fade it to 1.0 thus providing a better user experience.
Personally I don't like the UIWebView pool because I have experienced some memory troubles when maintaining it, especially on iOS 7 devices.
While attempting to optimize load speed I started placing timers in different places and looking at the performance. The app uses OpenGL and Core Data and has a decent amount of screens and artwork.
But the largest part of the lag seems to be taking place prior to applicationWillEnterForeground (assuming it's not a cold load)
The app shows up and is displayed and the UI is unresponsive for close to 5 seconds. I start a timer and print a time as soon as I can press a button. The time between applicationWillEnterForeground and when I can press the button is 200 milliseconds.
What can be causing my application to be slow to load prior to applicationWillEnterForeground or what can I do evaluate what is happening there? Instruments does not seem to display any information about that part of the launch.
Other testing app I have don't seem the same performance. Is it the bundle size or the amount of memory used by the application? Loading dynamic libraries?
This was related to OpenAL. The app was not closing the OpenAL context and for some reason this caused considerable problems when closing and reloading the app. The app uses CosCos Denshion so I to make sure to call these.
[CDAudioManager end];
[SimpleAudioEngine end];