LocoKit icon indicating copy to clipboard operation
LocoKit copied to clipboard

CLLocationManager thread safety

Open 0xTomDaniel opened this issue 4 years ago • 1 comments

If CLLocationManager should be created on the main thread or problems can occur. Here's the error message that is received when not created on the main thread.

A location manager (0x106634fc0) was created on a dispatch queue executing on a thread other than the main thread. It is the developer's responsibility to ensure that there is a run loop running on the thread on which the location manager object is allocated. In particular, creating location managers in arbitrary dispatch queues (not attached to the main queue) is not supported and will result in callbacks not being received.

A few hours was waisted figuring what was wrong with my app until I discovered this error message in my logs.

This pull request guarantees that CLLocationManager is always created on the main thread.

0xTomDaniel avatar Jul 05 '19 21:07 0xTomDaniel

@sobri909 Any word on this? There have been many commits since creating this.

0xTomDaniel avatar Apr 24 '20 17:04 0xTomDaniel