2015-11-23 34 views
4

我已经包括Crashlytics到我的应用程序。我做了注册向导并初始化Crashlytics为指导,像这样[Fabric with:@[[Crashlytics class]]];AppDelegate.mFabric.io Crashlytics和答案初始化

什么我需要做初始化的答案,什么在我的应用程序这样做的最佳地点?我现在只想要基本的初始化。

回答

1

对于基本指标,您需要在插件中包含答案套件才能使用答案!


对于初始化的答案跟面料

//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 

enter image description hereenter image description here


对于跟踪关键指标

答案可以跟踪您的应用程序中的关键度量标准,如构成的鸣叫,播放的歌曲和观看的视频。 通过将代码复制到您的项目中来跟踪您的应用程序的关键指标之一。

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 

一旦你成功地初始化,答案选项卡中显示您应用程序和关键指标 enter image description here

+0

出于某种原因,第一个“初始化面料回答”没有露面,但它与Crashlytics合作。也许我没有看到它。 – noobsmcgoobs

+3

@noobsmcgoobs对于你都可以这样使用 - > [Fabric with:@ [[Crashlytics class],[Answers class]]]; –

相关问题