关于[[NSNotificationCenter defaultCenter] addObserver不remove后续又收到通知crash问题
今天试了一个小demo,测出一个现象,同步出来:
object 作为 observer 监听了通知 A,然后 object 中途被释放执行了dealloc,随后app发出这个通知 A:
iOS 6、iOS 7、iOS 8: 必挂
iOS 9:不会挂
真机测试。
iOS 9.0 Documentation, 最新文档:
- addObserver:selector:name:object: 是说要添加remove observer的。
不知苹果后面 iOS9 小版本升级,会不会把这个改过来,现在这个现象和苹果的文档说法不一样。可能苹果在iOS9改了一个bug苹果内部自已防御了这个。
关于[[NSNotificationCenter defaultCenter] addObserver不remove后续又收到通知crash问题的更多相关文章
- ios NSNotificationCenter 收到通知后的执行线程
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Notifications/Articles/Thread ...
- 【翻译自mos文章】当/var/tmp文件夹被remove掉之后,GI crash,并启动失败,原因是ohasd can not create named pipe
来源于: GI crashes and fails to start after "/var/tmp" directory was removed as ohasd can not ...
- NSNotification --关于通知
一. 通知(NSNotification)的发送(Post)和注册(add)都必须借助于通知中心(NSNotificationCenter) 发送通知: NSNotificationCenter *c ...
- iOS 中的传值方式
一. 属性传值 将A页面所拥有的信息通过属性传递到B页面使用 很常用的传值,也很方便,但是要拿到类的属性.例如: B页面定义了一个naviTitle属性,在A页面中直接通过属性赋值将A页面中的值传 ...
- iOS NSNotification通知
通知中心(NSNotificationCenter) 通知(NSNotification) 一个完整的通知一般包含3个属性:(注意顺序) - (NSString *)name; 通知的名称 - (i ...
- ios 在ios9中 NSNotificationCenter addObserver 不会影响对象释放
如题,ios9上, [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(test) name:@&qu ...
- NSNotificationCenter带参
(1)post Notification类 [[NSNotificationCenter defaultCenter] postNotificationName:CRMPerformanceNewCe ...
- NSNotificationCenter 使用姿势详解
来源:JamesYu 链接:http://www.jianshu.com/p/a4d519e4e0d5 最近在做平板的过程中,发现了一些很不规范的代码.偶然修复支付bug的时候,看到其他项目代码,使用 ...
- NSNotificationCenter基础知识
NSNotificationCenter基础知识 Notification的工作机制 1.对应用程序中其他地方发生的事件(比如增加一条数据库记录)感兴趣的对象,会向通告中心(Notificatio ...
随机推荐
- 在脚本中使用source命令不生效
问题描述 1. 一次写自动化安装脚本,要安装java,需要将JAVA_HOME写到/etc/profile中,然后使用source命令,但是发现profile文件中确实有JAVA_HOME,使用 ...
- ●UVA 11796 Dog Distance
题链: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- 计蒜客NOIP2017提高组模拟赛(三)day1
火山喷发 火山喷发对所有附近的生物具有毁灭性的影响.在本题中,我们希望用数值来模拟这一过程. 在环境里有 n 个生物分别具有 A1,A2,⋯,An点生命值,一次火山喷发总计 MM 轮 ...
- NOIP2014-5-17模拟赛
Problem 1 双色球(ball.cpp/c/pas) [题目描述] 机房来了新一届的学弟学妹,邪恶的chenzeyu97发现一位学弟与他同名,于是他当起了善良的学长233 "来来来,学 ...
- 2015 多校联赛 ——HDU5302(矩阵快速幂)
The Goddess Of The Moon Sample Input 2 10 50 12 1213 1212 1313231 12312413 12312 4123 1231 3 131 5 5 ...
- hdu 4288 离线线段树+间隔求和
Coder Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- hdu5587 BestCoder Round #64 (div.2)
问题描述 Vicky是个热爱数学的魔法师,拥有复制创造的能力. 一开始他拥有一个数列{1}.每过一天,他将他当天的数列复制一遍,放在数列尾,并在两个数列间用0隔开.Vicky想做些改变,于是他将当天新 ...
- VS2017+xamain开发安卓(Addroid)应用
Visual Studio 2017下载地址: https://www.visualstudio.com/zh-hans/ 安卓模拟器官网下载: https://www.visualstudio.c ...
- python中int的功能简单介绍
Int的功能介绍 1. 绝对值 x.__abs__()等同于abs(x) 2. 加法 x.__add__(y)等同于x+y 3. 与运算 x.__and__(y)等同于x&y 4. 布尔运算 ...
- 在浏览器中运行Keras模型,并支持GPU
Keras.js 推荐一下网页上的 demo https://transcranial.github.io/keras-js/#/ 加载的比较慢,但是识别的非常快. Run Keras models ...