Bugly集成

Bugly集成

Bugly是一個(gè)強(qiáng)大的數(shù)據(jù)統(tǒng)計(jì)三方集成框架、它可以集成在你的app程序中,幫助你捕獲crash日志,集成十分容易,而且功能強(qiáng)大。

注冊(cè)登錄

Bugly是騰訊發(fā)布的一個(gè)三方,打開Bugly官網(wǎng)登錄進(jìn)入

2000C879-E273-4268-8B73-FC0E50A11502

點(diǎn)擊新建產(chǎn)品,填寫信息,完成后打開產(chǎn)品【設(shè)置】,記錄App ID

1AB1D4A0-2808-439E-9DB5-967E4C34E5D2
6AD63046-A20D-479C-9139-6F6FFB9EE3F1

打開BuglySDK下載
下載iOSSDK,里面有個(gè)Demo,可以查看官方文檔,參考Demo集成

下面是我的集成方法:

在AppDelegate.m的didFinishLaunchingWithOptions方法中,

 [self openBuglySDK];

在AppDelegate.m添加下面方法,

//BuglySDK
- (void)openBuglySDK{
    
    BuglyConfig *config = [[BuglyConfig alloc] init];
    config.reportLogLevel = BuglyLogLevelWarn;
    config.blockMonitorEnable = YES;
    config.blockMonitorTimeout = 2;
    config.consolelogEnable = YES;
    config.channel = @"Bugly";
    config.delegate = self;
    config.reportLogLevel = BuglyLogLevelWarn;
    
    [Bugly startWithAppId:BuglySDK_appID    //AppID
#if DEBUG
        developmentDevice:YES
#endif
                   config:config];
    
    [Bugly setUserIdentifier:[NSString stringWithFormat:@"User: %@", [UIDevice currentDevice].name]];
    
    [Bugly setUserValue:[NSProcessInfo processInfo].processName forKey:@"Process"];
    

    [self performSelectorInBackground:@selector(testLogOnBackground) withObject:nil];
}

- (void)testLogOnBackground {
    int cnt = 0;
    while (1) {
        cnt++;
        
        switch (cnt % 5) {
            case 0:
                BLYLogError(@"Test Log Print %d", cnt);
                break;
            case 4:
                BLYLogWarn(@"Test Log Print %d", cnt);
                break;
            case 3:
                BLYLogInfo(@"Test Log Print %d", cnt);
                BLYLogv(BuglyLogLevelWarn, @"BLLogv: Test", NULL);
                break;
            case 2:
                BLYLogDebug(@"Test Log Print %d", cnt);
                BLYLog(BuglyLogLevelError, @"BLLog : %@", @"Test BLLog");
                break;
            case 1:
            default:
                BLYLogVerbose(@"Test Log Print %d", cnt);
                break;
        }
        
        // print log interval 1 sec.
        sleep(1);
    }
}

#pragma mark -BuglyDelegate
- (NSString *)attachmentForException:(NSException *)exception {
    NSLog(@"(%@:%d) %s %@",[[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, __PRETTY_FUNCTION__,exception);
    
    return @"This is an attachment";
}

這樣就集成完了,簡(jiǎn)單吧。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 簡(jiǎn)單的記錄下在快速集成Bugly是遇到過的坑,更多說明去官方文檔,此文章,簡(jiǎn)單的集成bugly實(shí)現(xiàn)了,異常統(tǒng)計(jì),應(yīng)...
    一s獨(dú)秀閱讀 17,089評(píng)論 12 17
  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,173評(píng)論 25 708
  • 參考:微信TinkerBugly Android熱更新使用指南 有了Bugly幫助我們集成,那么我們就無需過多去關(guān)...
    Small_Cake閱讀 5,374評(píng)論 8 16
  • 當(dāng)app出現(xiàn)崩潰, 研發(fā)階段一般可以通過以下方式來跟蹤crash信息 模擬器運(yùn)行, 查看xcode錯(cuò)誤日志 真機(jī)調(diào)...
    Jackey_Zhou閱讀 1,102評(píng)論 0 0
  • 穹為蓋 川為鍋 水煮江山 沉浮間 光破霧靄 云蒸霞蔚 人生漫途 尋仙問路終枯骨 一息尚存 無愧無悔自在仙
    蒙山小道閱讀 322評(píng)論 0 0

友情鏈接更多精彩內(nèi)容