Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS5 What does "Discarding message for event 0 because of too many unprocessed messages" mean?

I'm doing some performance testing of my app and noticed that it takes exceedingly long to run some integrations. After a while, I got a whole bunch of

Discarding message for event 0 because of too many unprocessed messages

in the xcode console. What does this mean precisely?

like image 312
Alex Stone Avatar asked Oct 22 '11 04:10

Alex Stone


2 Answers

This what Apple Technical Support says about this (after paying $49 for a Developer Tech Support Incident):

These messages are coming from Core Location framework. The most likely cause of these messages is that there isn't a run loop running on the thread on which the CLLocationManager was created. (This implies that the CLLocationManager wasn't created on the main thread.) The messages that are being discarded are location messages: event 0 is a location and event 24 is an authorization status update, for example. Because the messages being discarded, you won't see the appropriate delegate callbacks being invoked. Did you set up a geofence or some other callback and isn't servicing it quickly enough? The queue limit appears to be 10 before it starts dumping events and logging this message. This information isn't publicly documented yet. I'm working with the Core Location team to improve the reported messages and see if this can be better documented.

like image 188
Michael Superczynski Avatar answered Oct 19 '22 04:10

Michael Superczynski


Michael is right, the reason is that location manager can only run on thread which has running loop on it (main thread by default), otherwise callbacks sent by it won't be handled. Please see following warning once I tried to initialize Zoosh SDK on a background thread:

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

It's clear. And putting the initialization into main thread clears this warning and no 'Discarding message for event 0 because of too many unprocessed messages' occurs.

like image 42
Chengjiong Avatar answered Oct 19 '22 04:10

Chengjiong