Upgrading Mapkit from iOS 7 to iOS 8

Asif Ahmed

I was busy today upgrading an iOS app I built earlier this year for marking your parking spot called ScoutAtlas. I heavily uses Mapkit to mark where you parked and later on give you directions back to where you parked. Since iOS 8 just came out yesterday (Wednesday, September 17th, 2014), I tested ScoutAtlas on a phone with an iOS 8 build. It was quickly evident that iOS 8 broke my app and made it completely not functional. The problem is that when using Mapkit in iOS 7, I could have just used something like the code below to show a user’s location.

However, in iOS 8, this just didn’t work. In iOS 8 you have to explicitly ask for a user’s permission to grant your app location services. You would need something more like in your code

Also remember to add a define for IS_OS_8_OR_LATER in your header file.

You also have to add two keys to your Appname-Info.plist file. You have to add a key of “NSLocationWhenInUseUsageDescription” and “NSLocationAlwaysUsageDescription” with values of the message you want displayed to the user (which asks them to grant you permission).

For a thorough guide on how to update for iOS 8 – check out this StackOverflow answer – http://stackoverflow.com/a/24718342.

Another StackOverflow answer that was helpful is on this thread – http://stackoverflow.com/questions/24062509/ios-8-location-services-not-working.

I’m sure any one who has Mapkit in their iOS 7 app is probably upgrading their app for proper authorization.

I’d also suggest looking at Apple documentation for Mapkit and CLLocationManager for more information about this two frameworks. The SEO at the time of this post is kinda broken for a lot of the Apple documentation so hopefully this helps you guys out.

Happy upgrading to iOS 8!

 

 

 

  • UfukUgur

    Thank you. That is what I was looking for !!

  • Sabina

    Thank you!

  • Afnan

    Great! thanks.

  • http://allendav.com allendav

    Awesome – thank you – works like a charm! One correction to the code above – you are alloc and init’ing the twice (once in line 3 and then again in 5.) I think the second alloc + init should not be there.

  • Harikrishna

    Thank you!

  • http://www.gamooz.com Jittender Thakur

    Thanks
    It is working….!!!!