How to use Crashlytics with iMessage Extensions?

泪湿孤枕 提交于 2019-12-12 09:48:04

问题


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

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;
}

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


回答1:


Mike from Fabric here.

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

  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:

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

Reference: https://stackoverflow.com/a/27153383/3975963




回答2:


Crashlytics isn't supported for iMessage extensions yet.

iMessage extensions aren't officially supported yet, but we're looking into adding it!



来源:https://stackoverflow.com/questions/40426044/how-to-use-crashlytics-with-imessage-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!