假如程序员编译了inhouse给测试。
如果在测试过程中出现奔溃现象,我想程序员一般会来看Device Log 也就是 crash文件
如果crash文件遇到如下的情况,在重要的地方看不到函数名称。我想是一件很奔溃的事情。
1 Exception Type: EXC_BAD_ACCESS (SIGSEGV) 2 Exception Codes: KERN_INVALID_ADDRESS at 0x00000000 3 Crashed Thread: 0 4 5 Thread 0 name: Dispatch queue: com.apple.main-thread 6 Thread 0 Crashed: 7 0 libsystem_c.dylib 0x37c0fe54 strlen + 12 8 1 libstdc++.6.dylib 0x38202410 std::string::operator=(char const*) + 8 9 2 FishingJoy 0x003423a0 0x1000 + 3412896 10 3 FishingJoy 0x00342b90 0x1000 + 3414928 11 4 FishingJoy 0x002fb3e0 0x1000 + 3122144 12 5 FishingJoy 0x002fae3c 0x1000 + 3120700 13 6 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36 14 7 FishingJoy 0x002d5614 0x1000 + 2967060 15 8 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36 16 9 Foundation 0x3548e750 __NSThreadPerformPerform + 344 17 10 CoreFoundation 0x38129afc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8 18 11 CoreFoundation 0x3812935e __CFRunLoopDoSources0 + 358 19 12 CoreFoundation 0x3812806e __CFRunLoopRun + 646 20 13 CoreFoundation 0x380ab4d6 CFRunLoopRunSpecific + 294 21 14 CoreFoundation 0x380ab39e CFRunLoopRunInMode + 98 22 15 GraphicsServices 0x37e82fc6 GSEventRunModal + 150 23 16 UIKit 0x31c2b73c UIApplicationMain + 1084 24 17 FishingJoy 0x0000389c 0x1000 + 10396 25 18 FishingJoy 0x0000383c 0x1000 + 10300
其实我们可以还原出函数名称,现在需要软件“symbolicatecrash”(点击下载)和编译这台inhouse的电脑。
1、先下载symbolicatecrash,放入一个干净的目录下。顺便把crash文件也拖入此目录。
2、先把app文件给弄出来,步骤Xcode -> Window -> Organizer -> Archives -> 右击给测试的包->“Show in Finder”->“显示包内容”->复制目录“Products/Applications/”下面的.app到 symbolicatecrash同级目录下。
3、打开终端(terminal)首先把symbolicatecrash拖入终端,现在终端会显示symbolicatecrash的地址并在末尾加入空格,不要回车然后依次把crash和app都拖入终端。
现在终端应该是(我在这里因为举例,先去掉绝对目录地址。大家看到的应该是一堆):
symbolicatecrash a.crash a.app
在末尾加入输出地址:
symbolicatecrash a.crash a.app > b.crash 回车。
现在去输出地址看 b.crash,应该已经成功显示函数名称了。
(非常重要的一点就是 symbolicatecrash 必须和编译该应用的XCode相匹配,可在Xcode包内找到:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash)
1 Exception Type: EXC_BAD_ACCESS (SIGSEGV) 2 Exception Codes: KERN_INVALID_ADDRESS at 0x00000000 3 Crashed Thread: 0 4 5 Thread 0 name: Dispatch queue: com.apple.main-thread 6 Thread 0 Crashed: 7 0 libsystem_c.dylib 0x37c0fe54 strlen + 12 8 1 libstdc++.6.dylib 0x38202410 std::string::operator=(char const*) + 8 9 2 FishingJoy 0x003423a0 FishNetCollideHandler::JSONLoaderDidLoad(char const*) + 1936 10 3 FishingJoy 0x00342b90 non-virtual thunk to FishNetCollideHandler::JSONLoaderDidLoad(char const*) + 32 11 4 FishingJoy 0x002fb3e0 -[JSONLoaderDelegateEx JSONLoaderDidLoad:withResult:] + 144 12 5 FishingJoy 0x002fae3c -[JSONLoader requestFinished:] + 352 13 6 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36 14 7 FishingJoy 0x002d5614 -[ASIHTTPRequest reportFinished] + 164 15 8 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36 16 9 Foundation 0x3548e750 __NSThreadPerformPerform + 344 17 10 CoreFoundation 0x38129afc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8 18 11 CoreFoundation 0x3812935e __CFRunLoopDoSources0 + 358 19 12 CoreFoundation 0x3812806e __CFRunLoopRun + 646 20 13 CoreFoundation 0x380ab4d6 CFRunLoopRunSpecific + 294 21 14 CoreFoundation 0x380ab39e CFRunLoopRunInMode + 98 22 15 GraphicsServices 0x37e82fc6 GSEventRunModal + 150 23 16 UIKit 0x31c2b73c UIApplicationMain + 1084 24 17 FishingJoy 0x0000389c main + 84 25 18 FishingJoy 0x0000383c start + 32