Re: MapKit location authorization
Re: MapKit location authorization
- Subject: Re: MapKit location authorization
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 20 Sep 2014 01:01:13 +0700
On 19 Sep 2014, at 20:21, Roland King <email@hidden> wrote:
>
>> On 19 Sep 2014, at 8:59 pm, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> My iOS app running on 8.0 says:
>> "Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first."
>>
>> Two questions:
>> 1. where is requestWhenInUseAuthorization documented?
>
> In the documentation for CLLocationManager, for iOS, not OSX. It’s worth remembering at this point the recent conversations on the Xcode list about how the documentation for Xcode is entirely borked, not coming from what’s local on the box and showing anything it feels like whether you ask for OSX or iOS, you’re probably looking at the OSX one even though you didn’t ask for it. use google, or Dash.
You are right. I asked for iOS and got something talking about 10.6 - obviously OS X stuff.
>
>
>>
>> 2. Where am I "trying to start MapKit location updates" ? I don't do this knowingly.
>> Or qualifies the mere usage of MapKit as "trying to start MapKit location updates”?
>
> I have no idea. What are you doing which uses maps, or core location?
I have a MKMapView
>
>>
>> Where or when should I ask for authorisation? AppDidFinishLunching?
>
> Avoiding the obvious joke about apps being happy after they have finished lunch ..
>
> That would be exactly the place Apple recommends you *don’t* ask for it. Possibly, very possibly if you were asking for requestAlwaysAuthorization it might be a place to do it, but the recommendation is never to ask for blanket permission at the start of an app before the user has a clue why you want it, but ask only at or around the point they have requested something which they will understand is the cause of your app asking for permission. Else they normally either say no or say no, delete your app and give it a one-star rating. So you need to figure out what it is you’re doing which triggers the request and ask in response to a user action.
So I put it into viewDidLoad of the view controller for the MapView.
But:
authorizationStatus = kCLAuthorizationStatusNotDetermined
locationServicesEnabled = YES
so I do (as recommended):
[ self.locationManager requestWhenInUseAuthorization ];
Now I would expect a panel to come up, asking the user "Do you want to allow this app to use Location Services?"
But nothing is seen (iOS 8.0).
And when I ask the manager for a location, I just get nil.
Later on I get: locationManager:didChangeAuthorizationStatus: kCLAuthorizationStatusNotDetermined
and: "Trying to start MapKit location updates without prompting for location authorization."
Not very useful.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden