iphone – 调试NSNotificationCenter问题的方法?

栏目: IOS · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/2123846/methods-to-debug-nsnotificationcenter-issues

我发布的通知中有一些问题:

[[NSNotificationCenter defaultCenter] postNotificationName:@"MobileProviderChanged" 
                                                    object:self.selectedProviderID];

不被我的观察者困住:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(onProviderChanged:) 
                                             name:@"MobileProviderChanged"
                                           object:nil];

完全相同的观察者在不同的ViewController中正常工作.

有关调试此方法的任何提示,以查看实际发布到defaultCenter的消息是什么?

谢谢.

The more I research this issue I  wonder if my problem is that the  sending viewcontroller is on a  different thread than the observing  viewcontroller.

不正确的多线程几乎肯定是您的问题的根源.但是,仍应发送和接收通知.

具体而言,将收到有关发送的任何线程的通知.既然你提到你正在使用视图控制器来响应通知,很可能你在非主要线程上做了一些UIKit不满意的事情.

翻译自:https://stackoverflow.com/questions/2123846/methods-to-debug-nsnotificationcenter-issues


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Django 1.0 Template Development

Django 1.0 Template Development

Scott Newman / Packt / 2008 / 24.99

Django is a high-level Python web application framework designed to support the rapid development of dynamic websites, web applications, and web services. Getting the most out of its template system a......一起来看看 《Django 1.0 Template Development》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具