我已将Crashlytics包含在我的应用中。我按照[Fabric with:@[[Crashlytics class]]];
AppDelegate.m
按照指示完成了注册向导并初始化了Crashlytics
我需要做些什么来初始化答案以及在我的应用中最好的位置?我现在只想要基本的初始化。
答案 0 :(得分:1)
对于基本指标,您需要在插件中包含Answers Kit以使用Answers!
使用Fabric初始化答案
//AppDelegate.m
#import "AppDelegate.h"
#import <Fabric/Fabric.h>
#import <Answers/Answers.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Fabric with:@[[Answers class]]];
return YES;
}
@end
对于跟踪关键指标
答案可以跟踪您应用中的关键指标,例如推文,播放的歌曲和观看的视频。 然后将代码复制到项目中,以检测应用程序的关键指标之一。
ViewController.m
#import "ViewController.h"
#import <Answers/Answers.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Trigger Key Metric" forState:UIControlStateNormal];
[button addTarget:self action:@selector(anImportantUserAction) forControlEvents:UIControlEventTouchUpInside];
[button sizeToFit];
button.center = self.view.center;
[self.view addSubview:button];
}
- (void)anImportantUserAction {
// TODO: Move this method and customize the name and parameters to track your key metrics
// Use your own string attributes to track common values over time
// Use your own number attributes to track median value over time
[Answers logCustomEventWithName:@"Video Played" customAttributes:@{@"Category":@"Comedy",
@"Length":@350}];
}
@end