Location services in the IOS8
My app that's worked fine in iOS 7 doesn ' t work with the iOS 8 SDK.
CLLocationManagerDoesn ' t return a location, and I don't see my app under Settings > Location Services either. I did a Google search on the issue but nothing came up and what could is wrong?
My application runs well on the iOS7, but there is a problem on the iOS8.
In the iOS8, Cllocationmanager did not return an address, and I did not find the service in the Settings>location services, on Google also found no similar problems, where is the problem?
I ended up solving my own problem.
Apparently in IOS 8 SDK, requestAlwaysAuthorization (for background location) or (location only if foreground) call to is requestWhenInUseAuthorization CLLocationManager needed Before starting location updates.
There also needs to is NSLocationAlwaysUsageDescription or key in with a message to being displayed in the NSLocationWhenInUseUsageDescription Info.plist prompt. Adding these solved my problem.
Hope it helps someone else.
Finally, I solved the problem.
In the IOS8 SDK, you need additional requestalwaysauthorization (for background targeting) and requestwheninuseauthorization (as a foreground location), You need to call both methods before calling the Cllocationmanager update address. You also need to add additional nslocationalwaysusagedescription and nslocationwheninuseusaged in the Info.plist file. Escription, after doing this, I solved my problem.
According to the Apple docs:
Https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLLocationManager_ Class/index.html#//apple_ref/occ/instm/cllocationmanager/requestwheninuseauthorization
As of IOS 8, the presence of a NSLocationWhenInUseUsageDescription or a NSLocationAlwaysUsageDescription key value in your app's Info.plist file is required. It's then also necessary to request permission from the user prior to registering for location updates, either by calling [self.myLocationManager requestWhenInUseAuthorization]or [self.myLocationManager requestAlwaysAuthorization] depending on your need. The string entered into the Info.plist would then be displayed in the ensuing dialog.
If the user grants permission, it ' s business as usual. If They deny permission, then the delegate was not informed for location updates.
According to Apple's official documentation:
Https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLLocationManager_ Class/index.html#//apple_ref/occ/instm/cllocationmanager/requestwheninuseauthorization
On iOS8, you need to add a new key value nslocationwheninuseusagedescription or nslocationalwaysusagedescription in your plist file. Then, Each time you locate, you need to obtain the user's authorization information, by calling [self.myLocationManager requestWhenInUseAuthorization] or [Self.mylocationmanager requestalwaysauthorization], as to which one to call, This is based on your own needs. The key value information that you add to the Plist file will be prompted in the confirmation message.
If the user allows you to locate, you can use the positioning function as usual. If they refuse, the updated location will never be executed.
Location Services in IOS8