What causes (and how can I fix) this odd Core Location error?

后端 未结 7 1573
太阳男子
太阳男子 2021-02-05 12:42

ERROR,Generic,Time,320195751.128,Function,\"void CLClientHandleRegistrationTimerExpiry(__CFRunLoopTimer*, void*)\",Registration timer expired, but client is

相关标签:
7条回答
  • 2021-02-05 13:12

    Are you doing location stuff on the main thread? I had all sorts of bizarro issues with CLLocation API calls from a background thread. I moved a couple of key setup calls into the main thread, then everything worked fine.

    0 讨论(0)
  • 2021-02-05 13:13

    I don't know if this is the answer or not, but here's a hint...I'm working with assetFromURL and I'm getting intermittent failures to load images from the asset library. So I wrote a bit of code to test a theory, that loads every url in the library very quickly. I started seeing this error with this bit of code.

    So...my theory is that if you make a call that causes the location manager to show the "app wants your location" dialog, and then you continue to make calls while that dialog is up, you'll get this error. Once I acknowledged the dialog and re-ran the program, I didn't see this error any more.

    Hope that helps, it's just a guess.

    0 讨论(0)
  • 2021-02-05 13:14

    Going off of what @schillace had to share, is it possible that you're attempting to force location updates without heeding the user's authorization status?

    Try to hold off on calling -startUpdatingLocation until you know that [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized.

    0 讨论(0)
  • 2021-02-05 13:16

    Are you sure this is a problem? It looks to me like you are debugging to a breakpoint (effectively suspending the application) before the registration to the location manager is completed. Meanwhile, the timer expires and you haven't finished your registration. If you take out the breakpoints, does the message ever appear?

    0 讨论(0)
  • 2021-02-05 13:16

    I got the same error and figured out that it was because I had forgotten to mention that the class implements the CLLocationManagerDelegate in the .h file.

    Adding the CLLocationManagerDelegate to the header file, and the following line to point to the delegate solved the error for me.

    locationManager.delegate = self;
    [locationManager startUpdatingHeading];
    
    0 讨论(0)
  • 2021-02-05 13:17

    Have you implemented

    - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
    

    and does this catch it?

    You need to check for kCLErrorNetwork, kCLErrorDenied, kCLErrorHeadingFailure and kCLErrorLocationUnknown in the normal run of things but I'm wondering if there are other errors that the delegate can still catch?

    This could give you the opportunity to stop and then restart location services.

    0 讨论(0)
提交回复
热议问题