iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Location service provides a streamlined way to access location API that conforms to each the device’s platform. In order to get the current location of the device, we use following snippet code:
if (locationResult.Error == null)
This method translate to, get the current location of the device, with best accuracy.
Some of you might found out that the code fails silently. You will get no error or warning, but it will never get a location update. The app will never even ask for permission to use location.
It took me a while until I found that we need to add a key to Info.plist and request authorization from the location manager asking it to start. It’s an iOS 8 (and later) related issue. The key, NSLocationWhenInUseUsageDescription, is required when you request authorization for location services. If this key is not present, the system ignores your request and prevents your app from using location services.
So we’ll need to add the key to the Info.plist file. It takes a string which is a description of why the app need location services. We can enter a string like “Location is required to find out where you are”.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<string>Location is required to find out where you are.</string>
Save the changes and re-run the app. Your app will now requesting permission by showing a popup.
Hopefully this post may helps developers using location services on iOS 8 (or later). If you have questions or feedback please feel free to submit in the comments section below.
Forgot your password | Sign up
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname
Already a member? Sign in