Question

I've got an iOS app in which it starts differently if the user has been logged in through Facebook account or not.

So the application flow is as follows:

1- I call app delegate, which creates a navigationController and shows it.

2- In the root view controller, it checks if the user is logged in or not. By default (for example during the first boot) it loads view controllers as not logged in, showing only contents for not logged user. if the user is logged with Facebook account it sends requests to a server and shows the contents for logged in user. The requests start with didupdatelocation delegated method, from which it gets the current location.

3- there are many places in which the app asks if you want to log in. If the user gets correct login, it creates a new navigation controller, as in app delegate, and displays it. The problem is that in this way it doesn't call the method didupdatelocation, and so it doesn't get current location and doesn't make any request to server.

How can you suggest me to solve the problem?

Was it helpful?

Solution

Your design should not rely on didUpdateLocation to be called. This method is called at non-predictable intervals by the system.

One way to force it to call however, is to stop the locationManager and start it again.

startUpdatingLocation
stopUpdatingLocation

However, I recommend you consult the CLLocationManager Class Reference and re-design your login check accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top