Ios Fabric.io Crashlytics和Answers初始化
我已将Crashlytics包含到我的应用程序中。我完成了注册向导,并按照指示初始化了Crashlytics,如soIos Fabric.io Crashlytics和Answers初始化,ios,crashlytics,twitter-fabric,Ios,Crashlytics,Twitter Fabric,我已将Crashlytics包含到我的应用程序中。我完成了注册向导,并按照指示初始化了Crashlytics,如so[Fabric with:@[[Crashlytics class]]在myAppDelegate.m中 我需要做什么来初始化答案?在我的应用程序中,什么是初始化答案的最佳位置?我现在只需要基本的初始化 对于基本指标,您需要包含插件中的答案工具包才能使用答案 用于使用结构初始化答案 //AppDelegate.m #import "AppDelegate.h" #import
[Fabric with:@[[Crashlytics class]]代码>在myAppDelegate.m中
我需要做什么来初始化答案?在我的应用程序中,什么是初始化答案的最佳位置?我现在只需要基本的初始化 对于基本指标,您需要包含插件中的答案工具包才能使用答案
用于使用结构初始化答案
//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
//AppDelegate.m
#导入“AppDelegate.h”
#进口
#进口
用于跟踪关键点指标
//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
#导入“ViewController.h”
#导入由于某种原因,第一个“使用结构初始化答案”没有出现,但在Crashlytics中出现了。也许我没看到。@noobsmgoobs两者都可以这样使用->[Fabric with:@[[Crashlytics class],[Answers class]]@Vinetchoudhary我收到一个错误,说“Fabric/Fabric.h”文件找不到。我在另一个SO问题()中看到,我需要配置Teamcity,但我还没有安装。你使用Teamcity吗?你知道没有Teamcity怎么解决这个问题吗?@Yossi我不使用Teamcity。我在Gitlab中使用了带有AppBox()的自托管Jenkins,我从未遇到过这种问题。如果它在我的系统中99%的时间都能工作,那么它也能在詹金斯身上工作。有时我会忘记更新私钥:P@VineetChoudhary谢谢仍然卡在我的身体里。。。不知道如何解决:(