小胖说事35-----Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer posi

  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

时间: 2024-11-05 23:35:37

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

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]解决方法

1 2014-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

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

刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard 解

*** 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 > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backBtn.' 第一种情况:xib文件属性输出口连接错误,IBout多连或者忘关输入口 第二种情况:引入第三方的SDK会出现错误,

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 > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backBtn.' 第一种情况:xib文件属性输出口连接错误,IBout多连或者忘关输入口 第二种情况:引入第三方的SDK会出现错误,导入的

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x19862

并且xcode代码运行到UIApplicationDelegate的 [self.windowmakeKeyAndVisible];时停止,提示program received signal "SIGABRT" 今天打开工程后就出现了标题的崩溃,原来的工程我改过xib所以就提示一些错误,原来是我改了之后没有关联写方法,删除后就好了 这个问题的root cause是在xib中某个控件已经通过outlet连接到ViewController中的某个变量上了,后来变量删除了,但是这种连接关系没

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DataModel 0x7fe44b

self.model=[[DataModel alloc]init]; [self.model setValue:@"searph" forKey:@"stockName"]; [self.model setValue:@"10.0" forKey:@"price"]; [self.model addObserver:self forKeyPath:@"price" options:NSKeyValueOb

Terminating app due to uncaught exception 'NSRangeException', reason: -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'

首页 > iOS问答 > 详情 *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' *** First throw call stack: (0x1f9b012 0x1a90e7e 0x1f3d0b4 0x6baaf 0x1aa46b0 0x1c1bb

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

出现错误的情景: 使用Swift自定义Cell, 然后将这个Cell在OC中使用, 由于为了能够在OC中使用和使用起来命名比较规范 我在Swift自定义的Cell前加了 @objc(DSProductCell) 完整版是这样的: @objc(DSProductCell) class ProductCell: UITableViewCell {} 然后在xib上对cell进行搭建... 之后在OC使用的时候就出现了这个错误... 最后排查出现这个问题的原因: xib中的class没有加上前缀, 也

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

刚接触iOS,按照教程操作运行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard 解