UITableView的动画过程中坠毁,定影液找到,但不会找到根本原因,不知道为什么? [英] UITableView crash during animation, fixing solution found but doesn't locate root cause, wonder why?

查看:154
本文介绍了UITableView的动画过程中坠毁,定影液找到,但不会找到根本原因,不知道为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone项目我一直插入到的UITableView视图控制器为IBOutlet中,大部分时间它工作得很好,但做动画由popToRootViewControllerAnimated调用时会发生随机崩溃。僵尸跟踪它,找到坠毁的会费为UITableView的实例已被释放,但仍有发送给它的系统事件,因此崩溃。

我总是无论是在视图控制器的dealloc方法下列方法解决这类问题。

  tableView.dataSource =零; (在大多数情况下工作)
要么
[的tableView removeFromSuperview] (对于某些特殊情况下的工作)

虽然碰撞可以通过上述变化是固定的,但我仍然扑朔迷离。


  1. 它是苹果的缺陷,我们需要设置它的数据源零明确,以避免崩溃?或者,也许我们自己的应用程序code的问题呢?

  2. 任何人谁也经历了这样的碰撞,你知道什么是根本原因?

任何想法或讨论将AP ​​preciated,在此先感谢。

 在此输入code
异常类型:EXC_BAD_ACCESS(SIGSEGV)
异常codeS:KERN_INVALID_ADDRESS在0x626f6d37
坠毁主题:0主题0名:调度队列:com.apple.main线程
螺纹0坠毁:
0 libobjc.A.dylib 0x33fe0c98 objc_msgSend + 16
1 UIKit的0x364538f6 - [UITableView的(UITableViewInternal)_spacingForExtraSeparators] + 58
2 UIKit的0x3645337a - [UITableView的(_UITableViewPrivate)_adjustExtraSeparators] + 158
3 UIKit的0x36453218 - [UITableView的layoutSubviews] + 40
4 UIKit的0x363ff5f4 - [UIView的(CALayerDelegate)layoutSublayersOfLayer:] + 20
5的CoreFoundation 0x30e13efc - [NSObject的(NSObject的)performSelector:withObject:] + 16
6 QuartzCore 0x33d8dbae - [CALayer的layoutSublayers] + 114
7 QuartzCore 0x33d8d966 CALayerLayoutIfNeeded + 178
8 QuartzCore 0x33d931be CA ::语境:: commit_transaction(CA ::交易*)+ 206
9 QuartzCore 0x33d92fd0 CA ::交易::提交()+ 184
10 QuartzCore 0x33d8c04e CA ::交易:: observer_callback(__ CFRunLoopObserver *,无符号长,无效*)+ 50
11的CoreFoundation 0x30e7da2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10
12的CoreFoundation 0x30e7f45e __CFRunLoopDoObservers + 406
13的CoreFoundation 0x30e80754 __CFRunLoopRun + 848
14的CoreFoundation 0x30e10ebc CFRunLoopRunSpecific + 224
15的CoreFoundation 0x30e10dc4 CFRunLoopRunInMode + 52
16 GraphicsServices 0x34efe418 GSEventRunModal + 108
17 GraphicsServices 0x34efe4c4 GSEventRun + 56
18 UIKit的0x36428d62 - [UIApplication的_run] + 398
19 UIKit的0x36426800 UIApplicationMain + 664
20 ScoutFree 0x00099558为0x1000 + 623960
21 ScoutFree 0x00003618为0x1000 + 9752


解决方案

您忘了tableView.delegate设为零,所以你仍然可以得到崩溃,尤其是当动画是怎么回事(因为它要求现在死了控制器,新行) 。这不是苹果的缺陷,这是程序员的责任来清除这些引用。的tableView到零所以设置数据源和委托的属性,然后松开的tableview(由相应的属性设置为零或释放伊娃这样的[_iVar发行];伊娃=零;)

In my iphone project I always insert UITableView into the view controller as IBOutlet, most times it works well, but random crash will occur when do animation invoked by popToRootViewControllerAnimated. Track it by zombie, find the crash dues to UITableView instance has been deallocated, but there are still system events sent to it, so crash.

I always resolve such issue by either of the following methods in view controller's dealloc method.

tableView.dataSource = nil;   (work for most cases)
or
[tableView removeFromSuperview]; (work for some special cases)

Although the crash can be fixed by the above change, but I am still confusing.

  1. Is it apple's defect that we need to set its dataSource to nil explicitly to avoid crash? Or maybe our own app code has problem?
  2. Anyone who has also experienced such crash, do you know what's the root cause?

Any idea or discussion will be appreciated, thanks in advance.

enter code here
Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x626f6d37 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib 0x33fe0c98 objc_msgSend + 16 
1 UIKit 0x364538f6 -[UITableView(UITableViewInternal) _spacingForExtraSeparators] + 58 
2 UIKit 0x3645337a -[UITableView(_UITableViewPrivate) _adjustExtraSeparators] + 158 
3 UIKit 0x36453218 -[UITableView layoutSubviews] + 40 
4 UIKit 0x363ff5f4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 20 
5 CoreFoundation 0x30e13efc -[NSObject(NSObject) performSelector:withObject:] + 16 
6 QuartzCore 0x33d8dbae -[CALayer layoutSublayers] + 114 
7 QuartzCore 0x33d8d966 CALayerLayoutIfNeeded + 178 
8 QuartzCore 0x33d931be CA::Context::commit_transaction(CA::Transaction*) + 206 
9 QuartzCore 0x33d92fd0 CA::Transaction::commit() + 184 
10 QuartzCore 0x33d8c04e CA::Transaction::observer_callback(__CFRunLoopObserver*,     unsigned long, void*) + 50 
11 CoreFoundation 0x30e7da2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10 
12 CoreFoundation 0x30e7f45e __CFRunLoopDoObservers + 406 
13 CoreFoundation 0x30e80754 __CFRunLoopRun + 848 
14 CoreFoundation 0x30e10ebc CFRunLoopRunSpecific + 224 
15 CoreFoundation 0x30e10dc4 CFRunLoopRunInMode + 52 
16 GraphicsServices 0x34efe418 GSEventRunModal + 108 
17 GraphicsServices 0x34efe4c4 GSEventRun + 56 
18 UIKit 0x36428d62 -[UIApplication _run] + 398 
19 UIKit 0x36426800 UIApplicationMain + 664 
20 ScoutFree 0x00099558 0x1000 + 623960 
21 ScoutFree 0x00003618 0x1000 + 9752

解决方案

You forgot to set tableView.delegate to nil, so you can still get crashes, especially when animation is going(as it asks now dead controller for new rows). It's not Apple's defect, it's programmer responsibility to clear out those references. So set dataSource and delegate properties of tableView to nil, then release tableview(by setting corresponding property to nil or releasing iVar like this [_iVar release]; iVar = nil;)

这篇关于UITableView的动画过程中坠毁,定影液找到,但不会找到根本原因,不知道为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆