Lena requesting services

As soon as I install and run my application for the first time, it immediately requests location services, even if startUpdatingLocation has not been called. I have not even allocated an instance of CLLocationManager at this point. I would like this invitation to be executed lazily after I actually called so that the user does not blindly disconnect it. Has this thread changed recently with iOS? I remember how lazily asked about it. I am using firmware 5.1.

+7
source share
1 answer

It is interesting. I tested your hypothesis that the location manager is not even assigned, and yet the iOS Location Resolution dialog box opens. I tried the following troubleshooting. After each step, I ran the project on the device, and I could get the location popup in the last step.

  • Launch new application
  • require location in info.plist
  • gps required in info.plist file
  • CoreLocation link to the project
  • Import kernel location to header
  • Make and synthesize a property for a location manager
  • request CLLocationManager for + authorizationStatus
  • request CLLocationManager for + locationServicesEnabled
  • alloc init instance of CLLocationManager
  • tell CLLocationManager to start updating the location.

Only the last step prompted a hint. To make sure that I even created a viewController that clicked on the second view controller, which initialized the CLLocationManager and started updating the location. The permission popup window appeared only when clicking on the second controller. This is all with the latest Xcode running on 5.1.

I showed that location services still ask for permission only when you try and enable places, as it was in the previous SDKs. Maybe check your code, maybe paste it here so we can figure it out in more detail. :)

+5
source

All Articles