Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

location manager was created on a dispatch queue

what does this message mean?

NOTICE,A location manager (0xe86bdf0) 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.

like image 914
Kassem Avatar asked May 22 '12 17:05

Kassem


People also ask

What is a dispatch queue?

Dispatch queues are FIFO queues to which your application can submit tasks in the form of block objects. Dispatch queues execute tasks either serially or concurrently. Work submitted to dispatch queues executes on a pool of threads managed by the system.

Is DispatchQueue main serial?

The main dispatch queue is a globally available serial queue executing tasks on the application's main thread. As the main thread is used for UI updates it's important to be conscious when executing tasks on this queue.

What is DispatchQueue async?

To summarize, DispatchQueue. async allows you to schedule work to be done using a closure without blocking anything that's ongoing. In most cases where you need to dispatch to a dispatch queue you'll want to use async .

What is DispatchQueue global?

Background thread: global. DispatchQueue. global is managed by system, which can manage background thread by using qos(Quality of Service). The system will design resources according to what QoS we set for this task.


1 Answers

You must create the CLLocationManager on a thread with an active run loop, such as the main thread. You should not create it on a background thread. See CLLocationManager Class Reference for more information:

(Configuration of your location manager object must always occur on a thread with an active run loop, such as your application’s main thread.)

If you're interested in what exactly a run loop is, see Run Loops for further information.

like image 77
mservidio Avatar answered Sep 22 '22 00:09

mservidio