使用相机时切入后台报错:Thread1:EXC_BAD_ACCESS(code=1,address=0x1)解决办法之一
来源:互联网 发布:地形数据涉密规定 编辑:程序博客网 时间:2024/05/22 00:53
问题是ARC错误release的对象再次被release。
程序切入后台时不会走disapear方法
参考了http://songzengbin.github.io后总结如下
加入监听监听切入后台或进入前台,手动执行disappear
在init中
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterBackgorund:) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; #pragma mark application enterBackgorund enterForeground-(void)enterBackgorund:(NSNotification *)notif{[self viewWillDisappear:YES];}-(void)enterForeground:(NSNotification *)notif{[self viewWillAppear:YES];}- (void)viewWillAppear:(BOOL)animated{[self.mapView viewWillAppear];self.isMapViewShowing = !self.mapView.hidden;self.mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放}- (void)viewWillDisappear:(BOOL)animated{[self.mapView viewWillDisappear];self.isMapViewShowing = NO;self.mapView.delegate = nil; // 不用时,置nil}在dealloc中 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
0 0
- 使用相机时切入后台报错:Thread1:EXC_BAD_ACCESS(code=1,address=0x1)解决办法之一
- thread1:exc_breakpoint(code=报错
- vuforia unity 项目嵌入iOS 报错 UnityGfxDeviceWorker(14):EXC_BAD_ACCE(code = 1,address = 0x1)
- EXC_BAD_ACCESS(code=1,address=0x40000000c)
- EXC_BAD_ACCESS (code=2, address=0x0)
- EXC_BAD_ACCESS (code =2,address=0x6f7fffbc)
- EXC_BAD_ACCESS(code=1问题的解决办法
- xxxViewController进行pop时直接crash进main.m,EXC_BAD_ACCESS(code=1,address=0x20)
- 【OC】thread 1:exc_bad_access(code=1,address=0x7fff7d72a7a0) 的一种解决方法
- block 传值 遇到的出错点:Thread 1:EXC_BAD_ACCESS(code=1,address=0x10)
- Thread 1:EXC_BAD_ACCESS(code=1,address=0x70) (Done)
- EXC_BAD_ACCESS (code=1, address=0x0) when stepping in debugger
- iOS 崩溃调试 exc_bad_access(code=1,address=0x10)
- 关于ios开发中遇到thread 1:exc_bad_access(code=1,address=0x50000010)类似的问题
- ios开发笔记----exc_bad_access(code=1, address=0x789870)野指针错误,假死debug状态
- iOS程序警告:EXC_BAD_ACCESS(code=1
- iOS程序警告:EXC_BAD_ACCESS(code=1
- EXC_BAD_ACCESS on UIAlertview code=1
- android 常见的错误问题
- Tyvj_P3314 苹果摘陶陶(快排)
- Ubuntu 12.04 sogou_input 崩溃原因以及解决方案
- mac上安装MySql
- 自制操作系统 第2步
- 使用相机时切入后台报错:Thread1:EXC_BAD_ACCESS(code=1,address=0x1)解决办法之一
- HDU_1176免费馅饼
- eclipse安装插件!长时间停留在calculating requirements and dependencies 的解决方案
- 使用Leopard特殊参数简化Controller方法参数编写
- 入门专题第二题 poj 2965 The Pilots Brothers' refrigerator
- django-自带admin后台如何给某些field赋默认值(比如user=request.user)然后隐藏它
- 数据转换excel操作 Microsoft.Office.Interop.Excel.dll的使用
- 解决看优酷,土豆等flash视频时,看着看着就出现感叹号的深刻问题
- java常用工具类