转:http://www.cocoachina.com/bbs/read.php?tid=180736
下面建议如何用symbolicatecrash工具分析iOS Crash文件:
一、在桌面创建一个crash文件夹
1.Xcoe-Window-Organize找到Archives找到App-右击-Show in Finder
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_dc34066a40da3a5.png)
2.复制.app和.app.dSYM到crash夹文件:右击..xcarchive文件-显示包内容
如图:
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_88baea188b1ce9a.png)
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_d94aa505a9975df.png)
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_fed1414611fc9f6.png)
复制好以后如图:
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_8c146833c4d51b7.png)
二、首先找到symbolicatecrash工具存放的地址
1.打开终端输入以下命令:
find /Applications/Xcode.app -name symbolicatecrash -type f
你会找到:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/./symbolicatecrash
2.用命令将symbolicatecrash拷贝到桌面的crash文件夹里面,与.app和.app.dSYM放一起
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash /Users/angel/Desktop/crash
如图:
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_253d6b662882ae8.png)
3.将Crash文件也拷到当前文件夹里面
如图:
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_395adc2428e748a.png)
三、执行symbolicatecrash
1.打开终端用命令切换到桌面的crash目录下:
cd /Users/你的电脑名称/Desktop/crash
2.执行命令
./symbolicatecrash /Users/angelseahappiness/Desktop/crash/Control_2014-01-13-111838_Lynns-iPad3.crash /Users/angel/Desktop/crash/Control.app.dSYM > Control_symbol.crash
这时候终端有可能会出现:Error: "DEVELOPER_DIR" is not defined at ./symbolicatecrash line 60.
3.输入命令:export DEVELOPER_DIR="/Applications/XCode.app/Contents/Developer"
4.再执行./symbolicatecrash /Users/angelseahappiness/Desktop/crash/Control_2014-01-13-111838_Lynns-iPad3.crash /Users/angel/Desktop/crash/Control.app.dSYM > Control_symbol.crash
这时候终端将会进行处理了
5.将终端完成以后,在crash文件夹里面会多出一个文件Control_symbol.crash:这个就是最终的文件,可以查看bug所在的
如图:
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_d6f772e25a31c5d.png)