Web view did finish delegate method is not called in iOS - ios

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.

Related

Load entire application at start up

I have a tabbed iOS application with each of the tabs having some sort of json request so the view loads ever so slightly slowly. I want to remove that lag completely so I'm wondering if there is a way to call the ViewDidLoad function from each of the classes during the login phase of the application.
if (login == "Success") {
UserDefaults.standard.set(true, forKey: "isUserLoggedIn");
UserDefaults.standard.synchronize();
DispatchQueue.main.async {
// Load all resources here
}
}
I can understand this can be bad practice if the app is very large, but I think in this scenario the app isn't huge, but the lag between the view controllers is enough to be annoying. I would rather have the user wait at the start for 3-5 seconds whilst everything loads, and have a smooth experience once inside. Is there a way to do this?
You shouldn't call the lifecycle functions of the viewcontroller for yourself. The viewDidLoad function will be called when the view has been loaded.
Apple: This method is called after the view controller has loaded its view hierarchy into memory.
So calling let _ = viewController.view will trigger the view creation and the call of this function.
But i think it's much better to have a startup phase instead. Think about a 'startup'-screen that downloads everything you need (with maybe a spinner and a text) and moves automatically to the content (the tabbar controller) when done. That may also fix the problem of a low network connectivity (think about a download that take a minute for example). You may display that screen modally above or as screen before the tabbbar controller.
If you don't like the idea of a startup phase you may also design your ui responsive. Start the download whenever needed / regularly and update your ui according to the results when ready. The ui will be fast then, but uses last known data. The meaningfulness and implementation depends on your content.
Update
On second thought: If you already have a server login screen, why not download the content directly after the successful download as part of the login? Users do not know if you are still checking the login or downloading some necessary data. You may say that login is only successful if server login AND download are finished successfully.

UWP Webview has no resume function

UWP Webview I am using it in C#/xaml app, to load websites, it has stop() method to halt the content loading but when I want to resume content loading, after it being stopped, how can I do that? for example, I have several webviews on same page, and at start I halt all of them for good performance, but then according to user commands I want to resume their content loading, and then if I want to stop again I can stop, also does stop method means that it pauses the content load? or stops it completely? so that next time we have to navigate again?
Stop is like the browser "Stop" button. It halts all content download and is not resumable.
You'll need to reload/refresh the page that you want to "resume." Depending on the web page, some of the content maybe cached locally already so to the user it may appear as if it loads more quickly.

Change zoomScale and contentOffset of UIScrollView in UIApplicationStateBackground state

I know it's not recommended to change any view appearance when the application is moved to background state, but for my specific task I cannot postpone this activity and I really like to complete it in a couple of seconds after the user hits the home button.
That's what I do:
I load a webpage in a UIWebView and after loading completion I change the contentOffset and zoomScale in order to make a specific screenshot of that webpage. When the app is in active application state everything works fine.
Now I wanted to add some more multitasking capabilities. I encapsulated the above described webpage loading and rendering activity in a protected background task (iOS Task Completion), in order to complete it even when the user hits the home button.
I have noticed that the page loading and the rendering of the webpage screenshot (with the renderInContext: method) works just fine in background, BUT it seems that the webview (i.e. the encapsulated UIScrollView instance) does not react on setContentOffset: and setZoomScale: messages as soon as the app is in background..
So I'm asking you if you know any alternatives to change the content offset / zoomscale? (modifications directly on CALayer?) Or any method to "force" the scrollview to perform the content changes even in background.
PS: On the iOS simulator everything works fine even in application background state, but on real devices it does not.
EDIT: I have created a simple demo project that demonstrates the issue. You can download it here (please read the instructions in the zip file): http://dl.dropbox.com/u/3556271/BackgroundBugDemo.zip
I appreciate every hint or tip. Thanks!

Application life cycle iOS

I having a problem with the application life in iOS programming. My application has the view controller that has been subclassed for drawing. Everything went fine till I decide that went the app go inactive (Press Home). I want it to load a new screen. I used notifications of applicationWillEnterForeground and a few others. What happens the drawing code fails when I try to get the UIGraphicsGetCurrentContext, it comes back as nil. I assume I am attempting to get the context before it is available. What is the proper event. I think I tried all but the right one.

UIWebView async requests blocks scrolling

I've been searching for something like this in SO and nothing came up. So i've decided to ask for the first time here.
I'm working on an iOS project. I have a UIWebView working fine with a NSURLRequest. But, when i load a URL with multiple asynchronous requests (i.e. wsj.com) like ads and Facebook likes stuff; the scroll interaction of the web view becomes laggy and unresponsive.
I've been debbugging and that happens when the delegate method shouldStartRequest is executed (several times)
First shoot: using threads. Didn't work.
Second shoot: playing with web view properties of interaction.
Third shoot: tried to stop the unnecessary calls (my business rules doesn't need them) didn't work. Even if i kill them, the laggy effect remains.
The curious thing about all this is that Safari renders and works fine with the same URL.
I'm looking for thoughts, does anybody has some clue of what's happening here?
Thanks!!

Resources