CrashLog常见类型
App大了后,各种奇怪的问题出现了,以下为碰到的常见的CrashLog,所有CrashLog都是Symbolicated,样本有些是Crashlytics的,有些是本地Xcode解析出来的.
CALayer position contains NaN
Fatal Exception: CALayerInvalidGeometry
0 CoreFoundation 0x1c9bfb3d __exceptionPreprocess
1 libobjc.A.dylib 0x1bc47067 objc_exception_throw
2 CoreFoundation 0x1c9bfa85 -[NSException initWithCoder:]
3 QuartzCore 0x1f83d82b CA::Layer::set_position(CA::Vec2<double> const&, bool)
4 QuartzCore 0x1f83d9e3 -[CALayer setPosition:]
5 QuartzCore 0x1f83e049 -[CALayer setFrame:]
6 UIKit 0x21be5429 -[UIView(Geometry) setFrame:]
7 UIKit 0x21bf7ffd -[UIImageView _setViewGeometry:forMetric:]
8 UIKit 0x21bf7f63 -[UIImageView setFrame:]
有时候觉得匪夷所思,但是它确实就产生了.产生的主要原因可能是除数是0, 网上看了看也有可能初始化造成,比如
UIEdgeInsets a;
a.left = (...some calculation);
button.imageEdgeInsets = a;
线程限制
Date/Time: 2017-08-17 15:32:36.822 +0800
Launch Time: 2017-08-17 15:24:50.041 +0800
OS Version: iOS 8.4.1 (12H321)
Report Version: 105
Exception Type: EXC_RESOURCE
Exception Subtype: WAKEUPS
Exception Message: (Limit 150/sec) Observed 269/sec over 300 secs
Triggered by Thread: 16
Your app is sending a wakeup command to a particular thread in the app quite often - apparently an average of 206 times a second. Background threads in iOS 8 have a hard limit on how many times you can run a sleep/wake cycle on each thread per second, and having a high count here is usually an indication that something is wrong / inefficient in your thread management.
Without seeing your code, my recommendation is that you check your C++ algorithms for sleep/wake calls, or multithread the background process to start new threads each cycle.
其他类型
Raywenderlich有很好的教程.