Prior to iOS 8, you only had two options when it came to sharing your location with App Store apps, share or don't share. That meant if you wanted an app to use your location while you were actively using it, but never in the background, you couldn't have both without changing settings. Now, you can have the best of both worlds by just changing a few settings.
How to restrict apps to only use your location while they're open
Launch the Settings app on your iPhone or iPad running iOS 8 or higher.
Tap on Privacy.
Tap on Location Services.
Find the app in the list you'd like to change location settings for and tap on it.
Choose which option you'd like that app to abide by.
Keep in mind that some apps may not show all three options. This is most likely because the developer has not yet implemented the while using this app option. If they do, you should see the option. It's not clear whether or not Apple will eventually require developers to use this setting. Personally, I don't think it's a bad idea. Do you?