Crashlytics的答案-添加自定义事件 [英] Answers By Crashlytics - adding custom event
问题描述
我有一个使用Crashlytics和Answers的应用程序。两者都工作正常,并且我看到正在跟踪的框架中内置了事件。
I have an app using Crashlytics with Answers. Both are working right, and I am seeing events that are built into the framework being tracked.
我试图通过使用以下代码行添加自定义事件在我的View Controller中:
I am trying to add a custom event, by using the following line of code in my View Controller:
Answers.logCustomEventWithName("Flight Complete", customAttributes: nil)
我的问题是编译器无法识别Answers对象。它只是告诉我使用未解析的标识符答案,这是有道理的,因为我从未声明过。
My issue is that the compiler doesn't recognize the Answers object. It just tells me "Use of unresolved identifier "Answers"" Which makes sense because I've never declared it.
我不确定在哪里或如何创建此答案。对象,因为它已经集成并且可以处理默认事件。有谁知道我应该在应用程序中声明要在哪里使用? (AppDelegate?)或声明是什么样的?他们没有在文档中显示它。
I am unsure of where or how to create this Answers object, as it is already integrated and working for default events. Does anyone know where I should declare it for use across the app? (AppDelegate?) or what the declaration looks like? They don't show it in the docs.
谢谢
更新:这是我尝试添加的内容到AppDelegate,但仍无法识别答案对象...
UPDATE: Here's what I've tried adding to AppDelegate but still not recognizing "Answers" object...
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Fabric.with([Crashlytics.self, Answers.self])
推荐答案
想要结束此问题,因为现在可以从评论中对其进行回答:
Wanted to close this question since it is now answered from the comments:
我未能致电
import Crashlytics
在顶部
此外,我还添加了
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Fabric.with([Crashlytics.self, Answers.self])
何时正确的是:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Fabric.with([Crashlytics.self])
答案包含在Crashlytics致电。
Answers is included in the Crashlytics call.
这篇关于Crashlytics的答案-添加自定义事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!