1. 2011-06-11 15:19:17.167 ***[930:707] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]'
  2. *** Call stack at first throw:
  3. (
  4. 0   CoreFoundation                      0x3365d64f __exceptionPreprocess + 114
  5. 1   libobjc.A.dylib                     0x33aa0c5d objc_exception_throw + 24
  6. 2   CoreFoundation                      0x3365d491 +[NSException raise:format:arguments:] + 68
  7. 3   CoreFoundation                      0x3365d4cb +[NSException raise:format:] + 34
  8. 4   QuartzCore                          0x361db61d _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 140
  9. 5   QuartzCore                          0x361db58b -[CALayer setPosition:] + 38
  10. 6   QuartzCore                          0x361db4d7 -[CALayer setFrame:] + 390
  11. 7   UIKit                               0x330eb455 -[UIView(Geometry) setFrame:] + 188
  12. 8   UIKit                               0x3314854f -[UITableViewCell setFrame:] + 98
  13. 9   UIKit                               0x33147b3b -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 850
  14. 10  UIKit                               0x3314776b -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 34
  15. 11  UIKit                               0x331400cd -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 936
  16. 12  UIKit                               0x3313f27d -[UITableView layoutSubviews] + 140
  17. 13  UIKit                               0x330eb5fb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
  18. 14  CoreFoundation                      0x335caf03 -[NSObject(NSObject) performSelector:withObject:] + 22
  19. 15  QuartzCore                          0x361dcbb5 -[CALayer layoutSublayers] + 120
  20. 16  QuartzCore                          0x361dc96d CALayerLayoutIfNeeded + 184
  21. 17  QuartzCore                          0x361e21c5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
  22. 18  QuartzCore                          0x361e1fd7 _ZN2CA11Transaction6commitEv + 190
  23. 19  QuartzCore                          0x361db055 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 56
  24. 20  CoreFoundation                      0x33634a35 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
  25. 21  CoreFoundation                      0x33636465 __CFRunLoopDoObservers + 412
  26. 22  CoreFoundation                      0x3363775b __CFRunLoopRun + 854
  27. 23  CoreFoundation                      0x335c7ec3 CFRunLoopRunSpecific + 230
  28. 24  CoreFoundation                      0x335c7dcb CFRunLoopRunInMode + 58
  29. 25  GraphicsServices                    0x3413041f GSEventRunModal + 114
  30. 26  GraphicsServices                    0x341304cb GSEventRun + 62
  31. 27  UIKit                               0x33114d69 -[UIApplication _run] + 404
  32. 28  UIKit                               0x33112807 UIApplicationMain + 670
  33. 29  PXiPhone                            0x000028df main + 70
  34. 30  PXiPhone                            0x00002894 start + 40
  35. )
  36. terminate called after throwing an instance of 'NSException

某天。加完一个功能,在iPhone4上报以上异常。然后crash掉,iPhone3上没事。

百思不得其解,于是google之。看了一篇stackoverflow.com 的文章,说是某些地方代码除以0了,多见于自己定义的UITableView自己定义UITableViewCell高度的地方。如:tableView:heightForHeaderInSection:tableView:heightForFooterInSection:。这两个delegate方法都没有地方须要除的。在细致看一下文章,说多见于适用sizeWithFont方法计算UILabel宽高的地方。恍然大悟,小弟有一个地方使用了UILabel来显示文本,须要用到sizeWithFont方法计算宽高的,在NSString为nil的时候,sizeWithFont会除以0了。

PS:在使用sizeWithFont计算UItabelView中label中字的长度时。因为表视图的cell是复用的,所以在计算label中的NSString的长度时,NSString可能为nil,此时可能会除以0。便会报错。

小胖说事35-----Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer posi的更多相关文章

  1. Terminating app due to uncaught exception 'NSUnknownKeyException' this class is not key value coding-compliant for the key

     Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > se ...

  2. *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key

    *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > ...

  3. 在使用可变数组过程中遇到*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'问题

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFD ...

  4. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

    报错: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlace ...

  5. iOS Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to

    刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', re ...

  6. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbackParameters 0x1d4442e50> setNilValueForKey]: could not set nil as the value for the key rate.'

    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbac ...

  7. Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CALayer: 0x7fda42c66e30> is a part of cycle in its layer tree'

    iOS App里面所有的View构成一个组件树,这个树里面如果有了闭环就会出现这个报错,最常见的你不小在某UIViewController里面写了这样的代码: someView.addSubView( ...

  8. iOS程序崩溃*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [37.5 nan]'

    今天上班打开昨天的程序运行,昨天跑的很溜的程序今天竟然crash了,好郁闷啊!下面附上crash的栈打印信息: 经过一番调试终于找到了原因,程序crash是因为CALayer的位置中含有不存在的数,就 ...

  9. Terminating app due to uncaught exception 'NSUnknownKeyException', reason: xxxx

    出现错误的情景: 使用Swift自定义Cell, 然后将这个Cell在OC中使用, 由于为了能够在OC中使用和使用起来命名比较规范 我在Swift自定义的Cell前加了 @objc(DSProduct ...

  10. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation setArgument:atIndex:]: index (3) out of bounds [-1, 2]'

    这是相机调用方法的时候参数错误

随机推荐

  1. Elasticsearch document深度剖析

    1. 针对Elasticsearch并发冲突问题,ES内部是如何解决的? 1)ES内部是线程异步并发修改的,是基于_version版本号进行乐观锁并发控制的: 2)若后修改的先到了,那么修改后版本发生 ...

  2. luogu P1866 编号

    题目描述 太郎有N只兔子,现在为了方便识别它们,太郎要给他们编号.兔子们向太郎表达了它们对号码的喜好,每个兔子i想要一个整数,介于1和Maxnumber[i]之间(包括1和Maxnumber[i]). ...

  3. ArrayList集合(JDK1.8)

    简述 List是继承于Collection接口,除了Collection通用的方法以外,扩展了部分只属于List的方法. 常用子类  ?ArrayList介绍 1.数据结构 其底层的数据结构是数组,数 ...

  4. ps---打开文件及图片保存格式

    1.打开图片,可以按Ctrl或者Shift来进行多张图片的选择或者用鼠标框选. 2.勾选图像序列,可以选择命名上有次序的多个图像. 3. PSD是ps里面的标准保存格式,包含颜色.图层.通道.路径.动 ...

  5. pwntools各使用模块简介

    pwntools pwntools 是一款专门用于CTF Exploit的python库,能够很方便的进行本地与远程利用的切换,并且里面包含多个模块,使利用变得简单.可以在github上直接搜索pwn ...

  6. 开门人和关门人(结构体+sort)

    每天第一个到机房的人要把门打开,最后一个离开的人要把门关好.现有一堆杂乱的机房签 到.签离记录,请根据记录找出当天开门和关门的人.    Input 测试输入的第一行给出记录的总天数N ( > ...

  7. OO博客作业

    第一次多项式的作业感觉还行,同时用c和java写的话也算是一个从c到java的过渡,也算是有了对 java的初步认识,之后的电梯作业出血了一些小BUG,比如有些情况考虑不完善之类的,也算是对面向对象有 ...

  8. mac下出现xcrun: error导致git无法使用的解决办法

    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun BY  ...

  9. 用spring annotation声明的bean,当打包在jar中时,无法被扫描到

    发现一个问题,十分蛋疼. 我们项目是由N个工程组成的,外围工程是web工程,内部的工程打包成jar,放入外围工程的WEB-INF/lib 内部的工程用到了spring的注解,例如@Service.@C ...

  10. unbuntu下安装多个JAVA JDK版本及如何切换

    当前环境已经安装过jdk1.6.0_45安装JDK 1.7.x时,若安装错误,可执行以下步骤:sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-ge ...