ios 8.3 UIWebView loading indicator not dissapearing - ios

I have a controller with a webview that loads some links. If the link takes some time to load, the webview shows a loading indicator (I don't do it, it is done automatically). If the link does not load, and the user goes back, while he goes to the previous controller, the webview's loading indicator is still active. Any suggestions on how to hide it?
EDIT: image of the indicator I mean:
Indicator

I assume you are referring to the indicator in the status bar that shows when there is network activity. If so, this indicator is controlled by calling
[[UIApplication sharedApplication].networkActivityIndicator=YES|NO;
Applications need to manage the indicator. UIWebView nor the URL loading components of iOS will do this for you.
You should stop a UIWebView instance from continuing to load its view by calling stopLoading.

Related

iOS app Killed and relaunched Showing my last VC

Killing and relaunching iOS app, If I have View Controller A,B,C last visible View Controller was C. So now when I relaunch app i see View Controller C for 10 sec and then shows up Splash Screen. How can I avoid this.
Because of this first 10 sec User cant perform any event on app.
I think this is an operation system bug. But if you want to avoid this, you can try to add a splash screen image view before your app will go to background. You need to add your custom overlay view as subview to current window. Use this method to implement this feature: applicationDidEnterBackground. You can find more information about this feature here:
Display a view or splash screen before applicationDidEnterBackground (to avoid active view screenshot)
To force iOS to launch an app with its default viewcontroller or launch image, you need to call
UIApplication.shared.ignoreSnapshotOnNextApplicationLaunch()
where you implement state preservation.
Form the documentation : Documentation
Prevents the app from using the recent snapshot image during the next launch cycle.

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.

SFSafariViewController hides network activity indicator when pushed in a UINavigationController

While SFSafariViewController is loading, we need to indicate to the user a website is loading in the ViewController we've just pushed.
The simplest idea is to turn on the network activity indicator before pushing the new SFSafariViewController and to turn it off in the delegate method once we know the website has loaded. However. when the SFSafariViewController slides in the UINavigationController, it slides over the app, which is fine, but the network activity indicator is not turned on anymore.
No network activity indicator is visible, so we can't communicate to the user that a website is being loaded. We need a way to communicate to the user that a website is being loaded in SFSafariViewController.
I think it's a bug! of iOS 9.
If anybody faced the same issue please tell me how to resolve.
The progress view in the SFSafariViewController is the indicator for a user to know that a website is loading and that is already built in, why would you need another one? If the progress view is hidden because you're pushing add this line to your code, so that you hide the navigation bar:
self.navigationController.navigationBarHidden = YES;

iOS Application loader (Splash)

I have an app that needs to fetch some remote configuration files before it starts or after it has been idle for some time in the background. I use a loader view controller to do the job while displaying a splash screen with a loading indicator.
What would be the best way to display the loader (assuming I also want to refresh the whole app after idle time in background):
Display as a modal view controller and dismiss when finished
Set the loader as root view controller and set back the original root when the loader finish (this method triggers a dealloc for the original root and creates it from scratch)
Go with option 1. I've used it many times and it works brilliantly. The best thing about using a modal view controller is that you can smoothly transition when you dismiss it, and you can just present it un-animated on applicationDidFinishLaunch so that it's there instantly for the user to see.
Display as a modal view controller and dismiss when finished.
This option will be more feasible when your app will starts from background state. You can show this with no animation show it will feel like splash and you can fetch remote configuration files.

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!

Resources