lundi 11 mai 2015

UIWebView first request too slow

I am using UIWebView to render web content in my application. I observed that the initial request when the app launches i.e. loadRequest, takes a long time to render the contents. However the subsequent requests which I don't track of, are much faster.
To confirm this, I created a standalone application which just has a UIWebView. This is the single line of code which I have added :

[wkBrowser loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.yahoo.com"]]];

The result is same. It takes around 15-20 seconds to load the page. However on tapping any link on web page, it takes 3-5 seconds to load the next page. I did put the UIWebView delegate function didFailLoadWithError, but there is never an error.
Question:

  1. Why is the first web request so slow ?
  2. How may I make it faster other than caching ?

Aucun commentaire:

Enregistrer un commentaire