"Don't Allow" in LocationManager keeps logging errors
I have an app that checked for location. It asks the user to use location and if the user says no on the menu there is an issue when i load the mapview.
Once i se开发者_如何学运维lect the mapView it asks for the user location again. If the user says no again my console keeps displaying errors/warning as well as my NSLog from the "didFailWithError" of my location Manager class.
Is there a way of stopping the LocationManage:didFailWithErrors if the user has already said no? I don't think Apple would accept my app if the Log file gets filled up my the LocationManager
Here is an example of what gets repeated in the console
ERROR,Time,290362745.002,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1
WARNING,Time,290362745.005,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1035.0 has been disconnected from daemon
2010-03-15 12:19:05.002 SAQ[1035:207] LocationManager Error Denied by user
Documentation on -didFailWithError:
method says:
If the user denies your application’s use of the location service, this method reports a kCLErrorDenied error. Upon receiving such an error, you should stop the location service.
So after receiving this error you should message you location manager to stop updating location:
[manager stopUpdatingLocation];
If you're using MKMapView I think setting its showsUserLocation
property to NO should do the trick.
It is your responsibility to check the error code and stop updating the location if the error code is kCLErrorDenied
.
精彩评论