问题描述:在使用天猫tangram框架后。部分组件自定义后会用到通知,但是在iOS 8 系统中,会崩溃?

原因分析:当对象挂掉后,要对应移除注册的通知。 否则当你重复执行发送通知的时候,在iOS8 系统以下,就会崩溃(其他系统暂时没有发现)。我们需要
在接受通知的类里移除通知。但是对于自定义的UIView类,该怎么操作呢?

方案解决:

//移除通知方法'
- (void)willMoveToWindow:(UIWindow*)newWindow {
    if(newWindow == nil) {
        // Will be removed from window, similar to -viewDidUnload.'
        // Unsubscribe from any notifications here.'
        [[NSNotificationCenterdefaultCenter] removeObserver:self];
    }
}
//添加通知方法'
- (void)didMoveToWindow {
    if(self.window) {
        // Added to a window, similar to -viewDidLoad.'
        // Subscribe to notifications here.'
        [PublicFunctionaddObserver:selfnotificationName:@"refreshTheOpPersonalActivity"selector:@selector(clearTheArryData) object:nil];
    }
}

最新文章

  1. java 基础导航
  2. 分享一个UI与业务逻辑分层的框架(三)
  3. 报表软件JS开发引用HTML DOM的windows对象
  4. C#在数据层过滤属性中的主键
  5. IP转换hash以及返回
  6. 详解 Spotlight on MySQL监控MySQL服务器
  7. AIX主机信任关系配置
  8. 给文件加ip访问限制
  9. zju 1091
  10. expdp与impdp
  11. 【React Native 实战】微信登录
  12. 浅谈Java泛型中的extends和super关键字(转)
  13. HDU 1131 Count the Trees
  14. 标准I/O 缓存
  15. linux下查找某个文件或目录
  16. java第三次上机
  17. Nginx 优先选择连接最少的上游服务器
  18. TXLSReadWriteII5 单元格读写
  19. 转:pycharm community debug django projects
  20. linux shell脚本中 mode=${1:-sart} filename=${fileuser:-"filename"}

热门文章

  1. ZooKeeper(一)基本介绍
  2. 强连通分量算法·$tarjan$初探
  3. (转)Jmeter http请求之content-type
  4. 1347: Last Digit (周期函数)
  5. [图解tensorflow源码] Session::Run()流程图 (单机版)
  6. 系统重装后恢复Oracle数据库
  7. ASP.NET中关于XML的AJAX的读取与删除
  8. windowbuilder
  9. 20155332 补交课后测试——ch11网络编程
  10. 5285: [Hnoi2018]寻宝游戏