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

IosXcodePerformanceDebugging

Ios Problem Overview


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?

Ios Solutions


Solution 1 - Ios

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.

Solution 2 - Ios

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex StoneView Question on Stackoverflow
Solution 1 - IosMichael SuperczynskiView Answer on Stackoverflow
Solution 2 - IosChengjiongView Answer on Stackoverflow