NSNotificationCenter的一个问题
来源:互联网 发布:免费门户网站源码 编辑:程序博客网 时间:2024/06/05 01:19
NSNotificationCenter在ios用的比较多,实际上就是一个观察者的模式,但是今天在使用中碰到了一个问题,特此纪录下,
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
即使object这个参数,不知道是不是工程用了arc的缘故,调用removeObserver,并没有删除掉这个MPMoviePlayerPlaybackDidFinishNotification,
原因是最早object这个参数是传值了,改成nil以后,顺利删除,
不太明白系统是怎么做的,如果object参数不为空的时候,是不是要retain count = 0的时候,才会真正在NSNotificationCenter中删掉,
产生问题就是我后面又使用了MPMoviePlayerPlaybackDidFinishNotification这个,造成了注册了两个MPMoviePlayerPlaybackDidFinishNotification,而前面一个又没有删除掉,
引起了错误。
- NSNotificationCenter的一个问题
- 一个简单的NSNotificationCenter使用
- NSNotificationCenter 用法 一个简单的使用 NSNotificationCenter 的代码例子
- NSNotificationCenter同步异步的问题
- 使用通知中心NSNotificationCenter遇到的问题
- NSNotificationCenter 跨线程问题
- NSNotificationCenter的使用以及需要注意的问题
- NSNotificationCenter 中的addObserver和addObserverForName的释放问题。
- iOS通知问题之:一眼就看懂的NSNotificationCenter应用
- NSNotificationCenter 中的addObserver和addObserverForName的释放问题。
- NSNotificationCenter 的使用
- NSNotificationCenter 的使用
- NSNotificationCenter的作用
- NSNotificationCenter 的使用
- NSNotificationCenter 的使用
- NSNotificationCenter的作用
- NSNotificationCenter 的使用
- NSNotificationCenter 的使用详解
- Android 中Activity,Window之间的关系
- 通向架构师的道路(第十四天)Axis2 Web Service安全之rampart
- SPOJ 371 Boxes
- do...while(0)的妙用
- BPDU Guard 與 Edge Port Protection
- NSNotificationCenter的一个问题
- 租房直通车(租房信息搜索工具)
- error LNK2001: 无法解析的外部符号 Qt的moc机制
- 小数问题
- struts2 ognl访问静态方法一定要配置!!!否则不能访问
- HDU What Are You Talking About
- gdb调试android
- 数据库镜像简介
- perl 参数传递