通过错误信息我们只能看到是有发生数组访问越界, 如果有添加exeception breakpoint则会自动停在发生error的代码行.
Demo#3. 真机运行, 查看device系统日志
xcode停止运行这个crashdemo, 选择xcode window - devices, 选择手机 - view device logs
然后在手机上运行crashdemo, 在device logs中按时间排序查看最新的log就能看到crashdemo的crash log
Incident Identifier: 9A4C52F0-B0D7-42C9-A7CB-D4D3321D00D5
CrashReporter Key: 90f4d3621773443794fa73f506fd6bdef49fc269
Hardware Model: iPhone4,1
Process: CrashDemo [1074]
Path: /private/var/containers/Bundle/Application/1307034E-9C2B-451F-ACD9-04C97DEC047B/CrashDemo.app/CrashDemo
Identifier: PEGA.CrashDemo
Version: 1 (1.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2016-10-29 12:21:49.49 +0800
Launch Time: 2016-10-29 12:21:43.43 +0800
OS Version: iOS 9.3.1 (13E238)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x211b3986 __exceptionPreprocess + 122
1 libobjc.A.dylib 0x2094ee12 objc_exception_throw + 34
2 CoreFoundation 0x211433e2 -[__NSArray0 objectAtIndex:] + 110
3 CrashDemo 0x000e6a36 0xe0000 + 27190
4 Foundation 0x219d1ad0 __NSFireDelayedPerform + 464
5 CoreFoundation 0x211765fa
这些在开发阶段都能很简便的实现, 但是当app发布出去后用户发生crash呢? 一般用户只能反馈在做什么的时候发生crash
然后我们在去做尝试是否能遇到, 不过这样效率不高而且一般很难复现到用户的crash
Bugly的出现解决的这个问题
Bugly SDK在当程序崩溃时, 会自动将错误信息发送到服务器方便开发人员查看分析
那么如何使用Bugly?
首先先到https://www.easck.com/v2/注册账号, 并注册app下载SDK包
将Bugly.framework拖拽到工程中, 记得勾选copy if needed.
然后添加libz.tbd / libstdc++.tbd / Security.framework / SystemConfiguration.framework到工程中
delegate.m中注册
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Bugly startWithAppId:@"此处替换为你的AppId"];
return YES;
}
这样当程序发生崩溃时, 崩溃信息会自动发送到服务器登录你的bugly账号就能查看到了

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!










