是什么可能导致有关 MKTileCache 的以下错误?
在控制台中,当我的应用程序运行时,我看到以下错误:
无效-[MKTileCache 同步](MKTileCache*, objc_selector*) 在 in 时调用 背景
此错误意味着什么?我该如何防止它?
In the console, I'm seeing the following error when my application runs:
void -[MKTileCache
synchronize](MKTileCache*,
objc_selector*) called while in
background
What could this error mean, and how can I prevent it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能正在从后台线程调用 MKMapView 上的用户界面函数。所有用户界面函数都应该从主线程调用;您可以在后台线程中使用
performSelectorOnMainThread:withObject:waitUntilDone:
来通知主线程在必要时执行适当的选择器。You are probably calling a user interface function on a MKMapView from a background thread. All user interface functions should be called from the main thread; you can use
performSelectorOnMainThread:withObject:waitUntilDone:
from your background thread to signal the main thread to perform the appropriate selectors when necessary.不一定,@Anomie。 “后台”不仅仅指主(UI)线程,还指后台(工作)线程。它还可以指后台应用程序(而不是活动应用程序)。我有一个使用 MapKit 的应用程序,它不支持多任务处理(退出时关闭)。当我关闭应用程序时,我总是看到此错误。直到应用程序离开“前台”后它才会出现。就我而言,我的某些代码绝对不是从工作线程调用 MapKit UI 函数。
所以,回答这个问题......我也看到了这一点。这似乎不是问题。我没有收到苹果或其他任何人的任何投诉。
我尝试在退出之前清空 MapView 的委托、MapView、CLLocationManager 的委托和 CLLocationManager。这些解决方案都没有消除此消息。
Not necessarily, @Anomie. "Background" doesn't just refer to the main (UI) thread, versus background (worker) threads. It can also be referring to apps that are backgrounded (not the active app). I have an app that uses MapKit, and it does not support multitasking (closes on exit). When I close my app, I always see this error. It does not appear until the app has left the "foreground". In my case, it's definitely not that some of my code is calling MapKit UI functions from worker threads.
So, to answer the question ... I see this, too. It does not appear to be a problem. I have not had any complaints from Apple, or anyone else.
I've tried nilling out my MapView's delegate, and the MapView, and the CLLocationManager's delegate, and the CLLocationManager, before exiting. None of these solutions get rid of this message.