2015-11-23 38 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]]]; –

相關問題