如何在iMessage Extensions中使用Crashlytics? [英] How to use Crashlytics with iMessage Extensions?

查看:92
本文介绍了如何在iMessage Extensions中使用Crashlytics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用程序中有一个iMessage扩展程序. Crashlytics可以捕获其崩溃吗?

I have an iMessage extension within my iOS app. Can Crashlytics capture its crashes?

我尝试将主应用程序Info.plist中的相同Fabric条目添加到iMessage扩展的Info.plist中,并将以下内容添加到我的MSMessagesAppViewController子类中(对于

I've tried adding the same Fabric entry from my main app's Info.plist into my iMessage extension's Info.plist, and adding the following to my MSMessagesAppViewController subclass (as recommended for Today widget intregation):

- (instancetype _Nonnull)initWithNibName:(NSString * _Nullable)nibNameOrNil
                                  bundle:(NSBundle * _Nullable)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil
                           bundle:nibBundleOrNil];
    if (self)
    {
        // Start up Answers and Crashlytics
        [Fabric with:[NSArray<id> arrayWithObjects:
                      [Answers class],
                      [Crashlytics class],
                      nil]];
    }

    return self;
}

但是,当我启动iMessage并选择我的iMessage扩展名时,它只是挂在上一个屏幕截图上.它永远不会开始.

But when I start iMessage and choose my iMessage extension, it just hangs on the previous screenshot. It never starts.

推荐答案

Fabric的Mike在这里.

Mike from Fabric here.

我们仅对iMessage Extensions上的Crashlytics提供实验性支持.要使工作正常进行:

We have experimental support for only Crashlytics on iMessage Extensions. To get things working:

  1. 将您的Fabric运行脚本构建阶段添加到扩展程序的 目标.将其复制并粘贴到您的主应用程序中.
  2. 将Fabric和Crashlytics.framework添加到扩展程序的 链接库
  3. Crashlytics.startWithAPIKey("YourActualApiKey")添加到您的 扩展程序的视图控制器的initWithCodermethod.如果你不这样做 当前有一个initWithCoder方法,它应该看起来像这样 最后:

  1. Add your Fabric Run Script Build Phase to your extension's target. Copy and paste the one in your main app.
  2. Add the Fabric and Crashlytics.framework to your extension's linked libraries
  3. Add the Crashlytics.startWithAPIKey("YourActualApiKey") to your extension's view controller's initWithCodermethod. If you don't have an initWithCoder method currently, it should look like this in the end:

必需的init(coder aDecoder:NSCoder){ super.init(编码器:aDecoder) Crashlytics.startWithAPIKey("yourApiKey") }

required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) Crashlytics.startWithAPIKey("yourApiKey") }

参考: https://stackoverflow.com/a/27153383/3975963

这篇关于如何在iMessage Extensions中使用Crashlytics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆