The first screen of my app is a MapView so when the user opens it up for the first time it prompts for Location Services. The issue is that immediately after the prompt comes up asking for location access it gets hidden (fades into the background) like some subview came over top of it.
Does anyone have a fix for this?
It sounds like you are either proceeding with another prompt for location services before the confirmation is given, or else you are on iOS 8 and prompting for location services (which is now asynchronous) and then going ahead and using them before this can complete.
Related
When I ran the app the NSLocationWhenInUsageDescription prompt came up once but never came up again after running it multiple times.
The app is still zooming into the current location and the Apple location.
The app works, but the question does not pop up.
Per the documentation: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestWhenInUseAuthorization, the question is asked only once, whether you tap "Allow" or "Deny". But you are still able to see the description in the Settings app, in Privacy settings, then Location services, and then your specific app. A description text should be displayed at the bottom of the view.
I'm using Google Map SDK 1.8.1 on ios 8,
I set Allow Location Access While Using The App:
And then everytime I using GMSMapView and Home, this one shows up.
(When there is an UIViewController that contains GMSMapView in navigation stack)
How can I dismiss it programmatically ?
Thanks you.
edit: sorry, I didn't make my question clear enough.
What I mean is how can I stop GMSMapView from using Location Service when users press Home button, I think that will do the trick.
I tried Google Map's app, the notification view does disappear when you Home, so I think it is possible.
You can't prevent the banner from displaying while you're using the user's location, it's information for the user provided by the system, for them to make informed decisions about which apps they share their location with and when.
Even if you found a way to do this, I'd be extremely surprised if it would get through app review. There's no specific rule about it, as it's not an option in the API anyway, but the gist of the guidelines is that the user should know what you're doing with their location, and when you're tracking it:
4. Location
4.1 : Apps that do not notify and obtain user consent before collecting, transmitting, or using location data will be rejected
Edit - responding to home button press
In order to stop using location when the user presses the home button, you need to subscribe to notifications about entering the background. When you initialise your class which is using location, register for the following:
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
Then, in the method which is called for that notification, stop using location:
-(void)appWillResignActive:(NSNotification*)note
{
//stop using location here. I'm not familar with GMSMapView, but assuming you have a reference to the map view, the documentation suggests this:
self.mapView.myLocationEnabled = NO;
}
You may also want to register for the UIApplicationWillEnterForegroundNotification so that you can pick location services back up again when the user opens your app again from the app switcher.
No way to hide it. Even if I stop Location updates.
One thing is for sure:
You must use NSLocationAlwaysUsageDescription in info.plist
and
request requestAlwaysAuthorization from LocationManager
in order to
hide the blue bar forever (and still have the background capability because of Location updates).
PS: I've seen someone speaking about having the blue line disappear after a while but that did not happen to me. Can anyone confirm of auto hiding blue bar?
In my app I'm updating user location every time when app becomes active. I stop CLLocationManager once updated location is received or in applicationWillResignActive:.
In Info.plist there is a NSLocationWhenInUseUsageDescription with appropriate description.
If app is activated and then immediately moved to background, blue banner saying that '%MyApp% is Using Your Location' appears for less then a second. This banner gets hidden as soon applicationWillResignActive: is called.
I've noticed the same problem in Google Maps, but not in Apple Maps.
Is there a way to get rid of this banner completely? Is there anything else I should do to make iOS happy? I do not want it to freak out my users and prevent them from using cool features that require location.
You have probably set location as Background mode in your info.plist. If you remove that, then the blue bar won't appear anymore.
Or, you can use requestAlwaysAuthorization instead of requestWhenInUseAuthorization on CLLocationManager (and provide the related NSLocationAlwaysUsageDescription in the info.plist file), and then it will not appear either.
In my case, my app is using location in the background in some cases, and I would like the blue bar to appear when that is the case. But I do not want it to appear when exiting the app without location in background. As far as I know that is not possible to achieve (I've asked about it here).
EDIT: Note that starting with iOS-9, you can make sure that the blue bar only appears when the user actually wants the app to use the location in the background. See this answer.
If you want to get access to the user's location with CLLocationManager, the app will need to show that banner and the user will need to press "Allow". If they don't do that, your location manager won't be able to detect the user's location.
Apple's Maps is a special case because it's a first party app.
Our app uses location services, and registers in the normal way. We have an issue on 1 (!) iPhone where it's not showing in the Location Services, no matter what we do. The question is, does anyone know if this is a bug in iOS, or could there be something we're not doing?
Any thoughts welcome.
The app needs to trigger location settings to appear open up Facebook on ur phone click on the top left corner then press on nearby and allow it once that is done Facebook will appear under location settings
The best way to trigger facebook location services is to go to settings in your facebook app, next go to events. In events you will find a setting icon you need to click that. it will popup location permissions. Select while using.
If you can't find the setting icon in events tab, try to create a new event and it will ask you for location.
Dear fellow developers,
I am trying hard to find a solution for my problem regarfing CLLocationManager.
I use a CLLocationManager instance in my Application. If the user selects the Home button on the device or terminates the application I want the location services to stop.
Therefor I call [self.locationManager stopUpdatingLocation]; - But this somehow doesn't work. The application enters the background and the small location arrow in the upper right corner of the status bar don't disappear. Even if I add [self.locationManager release] or self.locationManager.delegate = nil; - the location tracking don't stop :-/
It only disappears if I go to my device settings and switch off location services for the app. Whenever I switch back to location service enabled I immediately get a purple colored arrow next to the switch toggle and the icon reappears in the status bar.
My question is how can I turn off location services when the app enters the background or is terminated?
Thanks a lot in advance and have a nice day :-)
Your location is disabled. The location service icon "meaning" has changed on iOS 5. Take a look at this question: https://apple.stackexchange.com/questions/27463/why-is-the-location-services-icon-always-present
I Quote the answer:
It's a new feature in ios 5 called "region Monitoring"
The reason it's active even if the app is closed is that this feature
runs in iOS 5 core and notifies all apps that are registered when they
have entered or left a specific geo-fence.
Reminders does that when you use a location based reminder.
Although the location icon appears at all time. This actually has very
minimal impact on the battery due to apple really optimizing this
feature by using cell and wifi mostly.
Your app is working ok. The system behaviour is the one who changed.
You do it the right way. When entering background, it's ok if some delegate methods are called for some seconds. That should stop.
Where do you stop the location updates ? Are you sure it is triggered ? If yes, are your delegate method called even if the visual indicators tell something else ?
Are you sure you don't trigger a method that reactivate the location update after you have stopped it (because for example you can receive some updates even after stopped).
For instance if you started monitoring a significant location change, then you should unsubscribe from it with the corresponding pair method. If you are using region enter, then until you unsubscribe, the system will notify your delegates.