Many developers complain that mobile application development is more difficult than web application development. They try to follow tutorials online precisely, but the mobile application still doesn’t work. This is because mobile platforms evolve rapidly, and tutorials just can’t keep up to date.
My friend had the above situation and failed to get any location update from the location manager. He added the CoreLocation.framework library to Link Binary,
Then, he put the code below, and it seems right.
However, nothing comes out to the console. This is because, starting from iOS 8, you need to add NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription, depending on requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground).
Let’s start to build and run the app. You should see the alert below if you start it for the first time.
You should get an update after tapping Allow. You may need to adjust the location if you are running the Simulator by choosing a location from Debug -> Location.
I have uploaded the project to https://github.com/neoalienson/CLLocationManagerSample
Good luck, and I hope this tutorial does not become outdated very soon!