宽容他人,放过自己。

腾讯Bugly的接入

Posted on By anchoriteFili

相关引用


导入过程


1. 使用pod导入

pod 'Bugly'

2. 手动接入

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

3. 初始化SDK

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

#import <Bugly/Bugly.h> 如果是Swift工程,请在对应bridging-header.h中导入

初始化Bugly

  • Object-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Bugly startWithAppId:@"此处替换为你的AppId"];
    return YES;
}
  • Swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    Bugly.startWithAppId("此处替换为你的AppId")
    return true
}
  • 正常的使用
let TENCENT_BUGLY_APPID = "900001055"
let  CHANNEL_CODE = "iOS"


public func setupBugly() {
        
    let bugConfig = BuglyConfig()
    bugConfig.channel = CHANNEL_CODE
    bugConfig.version = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
    Bugly.start(withAppId: TENCENT_BUGLY_APPID, config: bugConfig)
    
}