xcode iOS5“由于太多未处理的消息而丢弃事件0的消息”是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7857323/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS5 What does "Discarding message for event 0 because of too many unprocessed messages" mean?
提问by Alex Stone
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?
在 xcode 控制台中。这究竟是什么意思?
回答by Michael Superczynski
This what Apple Technical Support says about this (after paying $49 for a Developer Tech Support Incident):
这是 Apple 技术支持对此的评论(在为开发人员技术支持事件支付 49 美元后):
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.
这些消息来自 Core Location 框架。这些消息的最可能原因是没有在创建 CLLocationManager 的线程上运行运行循环。(这意味着 CLLocationManager 不是在主线程上创建的。)被丢弃的消息是位置消息:例如,事件 0 是一个位置,事件 24 是一个授权状态更新。由于消息被丢弃,您将看不到正在调用的适当委托回调。您是否设置了地理围栏或其他一些回调并且没有足够快地为其提供服务?在开始转储事件和记录此消息之前,队列限制似乎是 10。此信息尚未公开记录。一世'
回答by Chengjiong
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:
迈克尔是对的,原因是位置管理器只能在有运行循环的线程上运行(默认为主线程),否则不会处理它发送的回调。一旦我尝试在后台线程上初始化 Zoosh SDK,请查看以下警告:
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.
注意,位置管理器 (0x11b5c9d0) 是在主线程以外的线程上执行的调度队列上创建的。开发人员有责任确保在分配位置管理器对象的线程上运行运行循环。特别是,不支持在任意调度队列(未附加到主队列)中创建位置管理器,这将导致无法接收回调。
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.
很明显。并将初始化放入主线程会清除此警告,并且不会发生“由于未处理的消息太多而丢弃事件 0 的消息”。