iOS-崩溃日志收集(Bugly&BugHD)

来源:互联网 发布:淘宝婴儿用品代理 编辑:程序博客网 时间:2024/06/05 16:56

啊,APP无缘无故的崩溃了,如果用模拟器,可以查看到是什么原因,断点调试到奔溃位置
但是,当APP安装在手机上,入Xcode断开的时候,崩了,咋办呢?
别怕,有很多第三方平台帮我们实时监控崩溃日志,并且能分析崩溃的原因及位置等信息


下面介绍两款简小的监控奔溃日志平台:Bugly 和 BugHD

一 Bugly快速集成

1 创建项目,获取AppId

点击进入Bugly官网

2 集成Bugly SDK

  • 方式一: CocoaPods 集成
pod 'Bugly'
  • 方式二: 手动集成

    • 下载并解压 iOS SDK
    • 拖拽 Bugly.framework 文件到Xcode工程内(请勾选 Copy items if needed 选项)
    • 添加依赖库
      • SystemConfiguration.framework
      • Security.framework
      • libz.tbd
      • liac++.tbd

这里写图片描述

3 在工程的AppDelegate.m文件导入头文件

#import <Bugly/Bugly.h>

4 在工程AppDelegate.m的application:didFinishLaunchingWithOptions:方法中初始化Bugly

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {         [Bugly startWithAppId:@"此处替换为你的AppId"];         return YES;   }

备注:如果App开启了 Bitcode,需要到 Targets –> Build settings –> 搜索 “Bitcode” –> 设置 Enable Bitcode 属性为NO
这里写图片描述

===========over 到此为止,就可以通过Bugly监控App崩溃信息了!!!===========


二 BugHD快速集成

1 创建项目,获取General Key

点击进入BugHD官网

2 集成BugHD SDK

  • 方式一: CocoaPods 集成
pod 'KSCrash'
  • 方式二: 手动集成

    • 下载并解压 iOS SDK
    • 拖拽 Bugly.framework 文件到Xcode工程内(请勾选 Copy items if needed 选项)
    • 添加依赖库

      • SystemConfiguration.framework
      • libz.tbd
      • liac++.tbd
    • 在”Build Settings”->”Other Linker Flags”添加 -ObjC 字段

这里写图片描述

3 在工程的AppDelegate.m文件导入头文件

#import <KSCrash/KSCrashInstallationStandard.h>

4 在工程AppDelegate.m的application:didFinishLaunchingWithOptions:方法中初始化BugHD

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    // Override point for customization after application launch.    KSCrashInstallationStandard* installation = [KSCrashInstallationStandard sharedInstance];    installation.url = [NSURL URLWithString:@"https://collector.bughd.com/kscrash?key=你的General Key"];    [installation install];    [installation sendAllReportsWithCompletion:nil];}

===========over 到此为止,就可以通过BugHD监控App崩溃信息了!!!===========


三 Bugly和BugHD监控崩溃信息分析对比

Bugly 监控平台:

这里写图片描述
崩溃详情:
这里写图片描述

BugHD监控平台:

这里写图片描述
崩溃详情:
这里写图片描述

综合对比:

- 我同时测试了Bugly 和  BugHD ,监控速度,Bugly 比 BugHD 快- 对于issue的分析,崩溃信息来自哪个设备,哪个系统版本,崩溃位置,时间,线程,堆栈等Bugly 比 BugHD 都能获取- 但Bugly监控的更全面,可以监控卡顿(抱歉, 没测)- Bugly是腾讯出的,有背景,人家可以拼爹

综上所述,具体使用哪个平台监控崩溃信息,看自己喜好. 还有监控奔溃的平台有很多,大家自主选择,合适自己的才是最好的.

0 0
原创粉丝点击