假如程序員編譯了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