Framework文件

  • FireflyStatistics.framework ;详细参见接入iOS

配置链接

  • 需要添加FireflyStatistics.framework的链接,以及对应的依赖链接

头文件引用

简单导入

#import <FireflyStatistics/FireflyStatistics.h>

接口

配置appkey和appsecret

首先向行为分析平台申请注册,通过审核后,会为每一个App分配一个appkey和appsecret,其和AppId绑定

+ (void)startWithAppKey:(NSString *)appKey secret:(NSString *)secret;

是否在控制台打印日志

便于调试阶段查看日志

+ (void)setIsLogEnabled:(BOOL)isLogEnabled;

登陆、登出

+ (void)login:(NSString * _Nonnull)userId;
+ (void)logout;

是否捕获崩溃信息

+ (void)setIsCaughtCrashEnabled:(BOOL)isCaughtCrashEnabled;

设置本地低优先级文件最大条数

+ (void)setMaxNumberLocalFile:(NSInteger)maxNumber;

设置本地指定优先级文件存储最大size

+ (void)setMaxFileSize:(int64_t)contentSize priority:(FireflyStatisticsLogPriority)priority;

日志写入快捷方法

1. FireflyStatisticsLog(NSDictionary *_Nonnull log);
2. FireflyStatisticsLog_priority(FireflyStatisticsLogPriority priority , NSDictionary *_Nonnull log);
3. FireflyStatisticsLog_options(NSString *_Nonnull type, FireflyStatisticsLogPriority priority , NSDictionary *_Nonnull log);

日志写入

1. + (void)ffsLog:(NSDictionary *_Nonnull)log;
2. + (void)ffsLogPriority:(FireflyStatisticsLogPriority) priority log:(NSDictionary *_Nonnull)log;
3. + (void)ffsLogOptions:(NSString *_Nonnull )type priority:(FireflyStatisticsLogPriority)priority log:(NSDictionary *_Nonnull)log;

页面时间统计

页面的时间统计函数:

1. FireflyStatisticsStartTracePage(NSString *_Nonnull pageName);
2. FireflyStatisticsEndTracePage(NSString *_Nonnull pageName);

使用

初始化

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


    [FireflyStatisticsAgent startWithAppKey:@"appkey" secret:@"appSecret"];
    [FireflyStatisticsAgent setIsCaughtCrashEnabled:NO];
    [FireflyStatisticsAgent setIsLogEnabled:YES];
    [FireflyStatisticsAgent setMaxNumberLocalFile:5];
    [FireflyStatisticsAgent setMaxFileSize:10000 * 1024 priority:FireflyStatisticsLogPriorityLow];
    [FireflyStatisticsAgent setTracePageLogPriority:FireflyStatisticsLogPriorityHigh];
    [FireflyStatisticsAgent setNetworkTypeOnSendData:(FireflyStatisticsNetworkTypeWifi)];
    [FireflyStatisticsAgent setIsSendDataAfterResignActive:YES];
    [FireflyStatisticsAgent checkLocalFileData];

    // Override point for customization after application launch.
    return YES;
}

写入日志

    FireflyStatisticsLog_options(@"log", FireflyStatisticsLogPriorityHigh, @{@"xcontext":@{@"testkey":@"testValue"}});
Copyright © 民生科技有限公司 2019 all right reserved,powered by Gitbook联系方式: wanglihang@mskj.com
修订时间: 2019-09-03 17:48:17

results matching ""

    No results matching ""