iOS 8 Map Kit Obj-C Cannot Get Users Location

前端 未结 8 689
[愿得一人]
[愿得一人] 2020-11-27 11:45

I am working with Map Kit in iOS 8 using Obj-C NOT SWIFT. I cannot get the device location it is set a 0.00, 0.00 and I am getting the error:

Trying to start         


        
8条回答
  •  渐次进展
    2020-11-27 12:14

    Your code looks fine, though you do not need to call requestWhenInUseAuthorization and the other requestAlwaysAuthorization , choose one you need.

    Code for displaying locations is just yet allocating locationManager, do not expect to get location data instantly.

    you need to wait till delegate method gets called : -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
    , then self.locationManager.location will also be set.

提交回复
热议问题