Ionic Framework – Geolocation iOS Store issues

WRITTEN BY GARETH DUNNE @DUNNEDEV

Geolocation

As I have recently published my Ionic app CoffeeTrail into the iOS store. I wanted to share with you some issues I experienced while trying to upload it.

Android Coffee Finder Application CoffeeTrail
CoffeeTrail

In total, the app was rejected twice due to lingering issues with my Ionic Native Geolocation plugin. These two issues were easily fixed although initially it wasn’t very obvious.

The first, was the lack of specificity when asking for the users location . A modal pops up asking for permission but I didn’t explain why I wanted to use their location. This goes against the iOS human interface guidelines which you can look at here.

I had to add two strings to my info.plist file. In order to do this, open up your iOS build generated from your Ionic project in Xcode.

Search for info.plist in your directory search panel:

 

And add these two strings with your custom location permissions message

  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysUsageDescription

After I added these custom messages my error modal looked something like this:

This fixed this initial rejection.

The second issue caused me the most trouble. Apple informed me that there was a second modal showing after the user already accepted the first location permissions one.

As you can see from above, the modal was giving a uninformative output path as my app name, which Apple deemed unfit for a user to see, which is fair enough as its a bit of a eyesore for the user.

This was not a custom made modal so it was coming from a native plugin, turns out it was one of two reasons

  • My Ionic Native Geolocation plugin was outdated
  • The Geolocation plugin was not correctly put into my iOS build output.

When you have added a plugin to your projects config.xml file, it won’t necessarily build into your platform of choice when you run the build commands.

These are the steps I had to run to rectify this:

So now our Geolocation plugin is updated with the latest version and with a custom location usage description

Next we need to remove our iOS platform:

Then we need to save all our plugins:

Adding the iOS platform back in now will also add in all our saved plugins from Cordova:

To make sure you now have the correct plugins run the command:

And compare that list to the plugins in the your build output folder:

{project-name}/platforms/ios/{project-name}/Plugins

These were the two obstacles I had to overcome to get Coffeetrail in the iOS store. Feel free to try it out and give feedback. As I’ve mentioned already it was rejected twice. On my third submission there was an extra processing time so thats something to be aware of if you want to be extra careful when submitting after that. Took an extra 4 days to be looked at.

I feel after finally submitting it I’m ready to undertake a React Native application.

Keep posted!