iOS-compile_debug-crash_record

来源:互联网 发布:js 数组 元素个数 编辑:程序博客网 时间:2024/06/15 02:09
1. 对同一个变量,在不同线程,同时读写的问题。 崩溃定位:越界。
解决方案:
变量加锁


2.
*** -[__NSCFString dataUsingEncoding:allowLossyConversion:]: didn't convert all characters
推测是某些字符不能转换,但也不应该崩溃呀。
解决方案:允许有损转换:
NSData* retData = [unicodeStr dataUsingEncoding: enc allowLossyConversion: YES]; // 使用allowLossyConversion参数


3. 
NSInvalidArgumentException
-[UIApplication applicationWillTerminate:]: unrecognized selector sent to instance 0x1c5919c0
0 CoreFoundation 0x311f364f __exceptionPreprocess 114
1 libobjc.A.dylib 0x34d0ec5d objc_exception_throw 24
2 CoreFoundation 0x311f71bf -[NSObject(NSObject) doesNotRecognizeSelector:] 102
3 CoreFoundation 0x311f6649 ___forwarding___ 508
4 CoreFoundation 0x3116d180 _CF_forwarding_prep_0 48
5 CommonTools 0x05d2cd71 setBacklightLevel 21976
6 CommonTools 0x05d3c233 memoryInfo 26634
7 CoreFoundation 0x31163571 -[NSObject(NSObject) performSelector:withObject:withObject:] 24
8 UIKit 0x31271ec9 -[UIApplication sendAction:to:from:forEvent:] 84
9 UIKit 0x31271e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] 32
10 UIKit 0x31271e3b -[UIControl sendAction:to:forEvent:] 38
11 UIKit 0x31271b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] 356
12 UIKit 0x31272423 -[UIControl touchesEnded:withEvent:] 342
13 UIKit 0x31257535 _UIGestureRecognizerSortAndSendDelayedTouches 2200
14 UIKit 0x31256c01 _UIGestureRecognizerUpdateObserver 696
15 CoreFoundation 0x311caa35 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 16
16 CoreFoundation 0x311cc465 __CFRunLoopDoObservers 412
17 CoreFoundation 0x311cd75b __CFRunLoopRun 854
18 CoreFoundation 0x3115dec3 CFRunLoopRunSpecific 230
19 CoreFoundation 0x3115ddcb CFRunLoopRunInMode 58
20 GraphicsServices 0x30adc41f GSEventRunModal 114
21 GraphicsServices 0x30adc4cb GSEventRun 62
22 UIKit 0x31283d69 -[UIApplication _run] 404
23 UIKit 0x31281807 UIApplicationMain 670
24 xxxx 0x000fed67 main 66
25 xxxx 0x000fe4a0 start 40
这个崩溃,基本集中在4.3.x的系统上。
由界面触发,但定位不到具体的操作或代码行。


第三方插件的崩溃,引起这个crash log。
验证:根据网上同类问题的解答,可以确定是91桌面的一个bug。可看下面的参考。
结论:91桌面(插件)在终止程序时,控制点在被终止的程序里,这时出现崩溃,于是被当作被终止程序的崩溃。
解决方法一:
对于包括CommonTools的崩溃(实际是用户终止程序),不作为崩溃统计。
///////////////////参考
I have met the same problem, I found it! CommonTools is the library of 91桌面, a jailbreak app. When the user install this app, they can kill the app with it directly. My app get an crash report on os 4.x, when they quit the app using this app. So you can check if your app have the same problem. Good luck!




4.
PLSqliteDatabase instances并没有支持线程安全,这个要由调用层来做。


多线程同时操作数据库,容易出现EXC_BAD_ACCESS的崩溃。
SQLITE_VERSION在3.3.1以上的库,都支持互斥以达到多线程安全。
默认互斥是打开的,且可以通过设置宏或调用sqlite3_config来设置是否打开互斥。
打开互斥,减弱性能。
sqlite3_threadsafe函数,返回值可以测试是否多线程安全(返回1或2时为多线程安全)。
但即使支持互斥且打开了互斥,还是存在这样的问题。


解决方法:使用fmdb,替换pldb。


5.
NSInvalidArgumentException
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
0 CoreFoundation 0x333763ff 186
1 libobjc.A.dylib 0x3b067963 objc_exception_throw 30
2 CoreFoundation 0x332c0c6d 776
解决办法:加判空。


6. 
NSInvalidArgumentException
*** setObjectForKey: object cannot be nil (key: image)
0 CoreFoundation 0x311632bb 186
1 libobjc.A.dylib 0x38e8097f objc_exception_throw 30
2 CoreFoundation 0x310c5313 142
解决办法:object不能为空,key也不能为空。


7. 
-[UINavigationBar setBackgroundImage:forBarMetrics:]: unrecognized selector sent to instance 0x1f531bf0
0 CoreFoundation 0x30b9c64f __exceptionPreprocess 114
1 libobjc.A.dylib 0x346b7c5d objc_exception_throw 24
2 CoreFoundation 0x30ba01bf -[NSObject(NSObject) doesNotRecognizeSelector:] 102
3 CoreFoundation 0x30b9f649 ___forwarding___ 508
4 CoreFoundation 0x30b16180 _CF_forwarding_prep_0 48
原因:setBackgroundImage:forBarMetrics:至少5.0的系统方支持。


8.
*** Collection <__NSArrayM: 0x200e8250> was mutated while being enumerated.
0 CoreFoundation 0x3279d3ff 186
1 libobjc.A.dylib 0x3a48e963 objc_exception_throw 30
2 CoreFoundation 0x3279cec1 0
解决办法一:拷贝再遍历。


9.
在send(socket, ..)时,socket已经关闭掉,引发SIGPIPE,即broken pipe异常,导致崩溃。
解决办法一:
加入SO_NOSIGPIPE的属性设置:
int set = 1;
    ::setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
对创建的监听socket,以及accept返回的socket都加上如此设置,再运行程序,正常。
0 0