-observeValueForKeyPath:ofObject:change:context: message was received but not handled.
来源:互联网 发布:风险评价矩阵 编辑:程序博客网 时间:2024/05/18 16:55
KVO报错
使用:A对象监听B对象中某个属性值的修改,在B对象上添加监听
添加监听:
[B addObserver:A forKeyPath:@”B的属性” options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
监听回调:
-(void)observeValueForKeyPath:(NSString )keyPath ofObject:(id)object change:(NSDictionary )change context:(void *)context
{
if ([@”属性名称” isEqualToString:keyPath]) {
//自己的逻辑处理
// object为B对象
//值的变化情况可以通过change获取
}
}
报错解决:
在同一个对象上仿佛的添加监听就会报该错误,解决办就是在添加监听前保证对象没有被监听。
-(void)dealloc // ARC模式下
{
[sectionModel removeObserver:self forKeyPath:@”isDone”];
}
0 0
- -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
- KVO 接收变更通知 observeValueForKeyPath:ofObject:change:context:
- the error was not handled
- the message "\$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop
- Call can throw, but it is not marked with 'try' and the error is not handled
- Swift:Call can throw, but it is not marked with 'try' and the error is not handled
- Swift Call can throw, but it is not marked with 'try' and the error is not handled
- 真机运行出现An unknown error message 'DeviceLocked', was received from the device.提示
- xcode "nib but the view outlet was not set."错误
- xcode "nib but the view outlet was not set."错误
- loaded some nib but the view outlet was not set
- loaded the nib but view outlet was not set
- The entity "nbsp" was referenced, but not declared
- loaded the "***" nib but the view outlet was not set
- xcode "nib but the view outlet was not set."错误
- 抛出nib but the view outlet was not set
- nib but the view outlet was not set.
- loaded some nib but the view outlet was not set
- struts2学习之三(第一个小页面)
- 陈华:JavaScript 2层FOR循环实现金字塔
- Ruby学习笔记2 : 一个简单的Ruby网站,搭建ruby环境
- mac下使用jenkins
- Intellij IDEA 配置svn(win7)
- -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
- 设计模式(行为型)之策略模式(Strategy Pattern)
- 项目启动会注意事项-甲方
- openstack学习笔记----Libvirt的虚拟化平台调度实现
- 编解码学习笔记(十五):MPEG-H和H.265
- IOS-表视图中添加搜索功能
- 绘制业务流程图:流程图绘制工具
- MySQL UUID函数和自增序列详解
- SAX与DOM 解析XML文件的区别