Initializing Crashlytics and Fabric.io Responses

I have included Crashlytics in my application. I made a registration wizard and initialized Crashlytics as indicated [Fabric with:@[[Crashlytics class]]];in myAppDelegate.m

What do I need to do to initialize the answers and what is the best place for this in my application? I just need basic initialization right now.

+4
source share
1 answer

For basic indicators, you need to include a set of answers from your plugin in order to use the answers!


Initialization of responses using tissue

//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 here enter image description here


Track mark

, , . , .

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

+1

Source: https://habr.com/ru/post/1616988/


All Articles