zoukankan      html  css  js  c++  java
  • bugly使用

    导入:

    1.Bugly.framework

    2.Security.framework

    3.SystemConfiguration.framework

    4.libc++.1.dylib

    5.libz.1.dylib

    AppDelegate.m 设置如下:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        

        [self setupBugly];

        

        return YES;

    }

    - (void)setupBugly {

        // Get the default config

        BuglyConfig * config = [[BuglyConfig alloc] init];

        

        // Open the debug mode to print the sdk log message.

        // Default value is NO, please DISABLE it in your RELEASE version.

    #if DEBUG

        config.debugMode = YES;

    #endif

        

        // Open the customized log record and report, BuglyLogLevelWarn will report Warn, Error log message.

        // Default value is BuglyLogLevelSilent that means DISABLE it.

        // You could change the value according to you need.

        config.reportLogLevel = BuglyLogLevelWarn;

        

        // Open the STUCK scene data in MAIN thread record and report.

        // Default value is NO

        config.blockMonitorEnable = YES;

        

        // Set the STUCK THRESHOLD time, when STUCK time > THRESHOLD it will record an event and report data when the app launched next time.

        // Default value is 3.5 second.

        config.blockMonitorTimeout = 1.5;

        

        // Set the app channel to deployment

        config.channel = @"Bugly";

        

        config.delegate = self;

        

        // NOTE:Required

        // Start the Bugly sdk with APP_ID and your config

        [Bugly startWithAppId:BUGLY_APP_ID

    #if DEBUG

            developmentDevice:YES

    #endif

                       config:config];

        

        // Set the customizd tag thats config in your APP registerd on the  bugly.qq.com

        // [Bugly setTag:1799];

        

        [Bugly setUserIdentifier:[NSString stringWithFormat:@"User: %@", [UIDevice currentDevice].name]];

        

        [Bugly setUserValue:[NSProcessInfo processInfo].processName forKey:@"Process"];

        

        // NOTE: This is only TEST code for BuglyLog , please UNCOMMENT it in your code.

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

    }

    /**

     *    @brief TEST method for BuglyLog

     */

    - (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";

    }

  • 相关阅读:
    工作需求----表单多选框checkbox交互
    工作需求——JQ小效果分享下
    JQ返回顶部代码分享~~~~
    css 分享之background-attachment 属性
    CSS3学习之分享下transition属性
    css 伪元素分享!!!
    phpcm v9 任意调用分页/phpcm v9首页调用分页不起作用或者乱码
    facebook分享不能显示图片链接问题
    Fatal error: Uncaught SoapFault exception:解决办法
    VUE项目 启动提示 npn ERRT nissing script: dev解决办法
  • 原文地址:https://www.cnblogs.com/tony0571/p/6029144.html
Copyright © 2011-2022 走看看