当我的应用程序在模拟器或我的应用程序的临时版本中崩溃时,错误日志会详细并清楚地说明应用程序崩溃的位置。然而,一旦它被提交到应用商店并且我的用户正在使用它,我发现由谷歌分析和我自己的方法记录的错误日志正在编辑太多,以至于我无法判断错误发生在哪里。
如何确保在 ios prod 应用程序中生成并提交完整的错误日志?
-[NSNull 长度]:无法识别的选择器发送到实例 0x19a1f1fe0
*****原因*****
-[NSNull 长度]:无法识别的选择器发送到实例 0x19a1f1fe0
*****姓名*****
NSInvalidArgumentException
*****堆栈跟踪*****
0 CoreFoundation 0x000000018d2ab11c + 160****1 libobjc.A.dylib 0x00000001997b41fc objc_exception_throw + 60****2 CoreFoundation
0x000000018d2afdb4 + 0****3 CoreFoundation
0x000000018d2adae0 + 912****4 CoreFoundation
0x000000018d1cd78c _CF_forwarding_prep_0 + 92*** *5
UIKIT 0x000000019027DF68 + 120 **** 6 MUZMATCH
0x00000000010019A138 MUZMATTE + 1302840 **** 7 uikit
0x00000000000190274658 + 576
************************
y190190190190190190190MMATTER
0x000000010010a470 muzmatch + 713840****11 libdispatch.dylib
0x0000000199d8c014 + 24****12 libdispatch.dylib
0x0000000199d8bfd4 + 16****13 libdispatch.dylib
0x0000000199d8f1dc _dispatch_main_queue_callback_4CF + 336****14 CoreFoundation 0x000000018d26addc + 12****15 CoreFoundation 0x000000018d26911c + 1452****16 CoreFoundation
0x000000018d1a9dd0 CFRunLoopRunSpecific + 452****17 GraphicsServices 0x0000000192e91c0c GSEventRunModal + 168****18 UIKit
0x00000001902dafc4 UIApplicationMain + 1156****19 muzmatch
0x00000001001ac608 muzmatch + 1377800****20 libdyld.dylib
0x0000000199da7aa0 + 4
我正在创建错误日志并将其保存到数据库中:
NSString *message=[exception debugDescription];
message = [message stringByAppendingString:@"\n\n*****REASON*****\n\n"];
message = [message stringByAppendingString:[exception reason]];
message = [message stringByAppendingString:@"\n\n*****NAME*****\n\n"];
message = [message stringByAppendingString:[exception name]];
message = [message stringByAppendingString:@"\n\n*****STACK TRACE*****\n\n"];
NSArray *ar = [exception callStackSymbols];
message = [message stringByAppendingString:[ar componentsJoinedByString:@"****"]];
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createExceptionWithDescription:message withFatal:@YES] build]];