问题
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:
- Add your Fabric Run Script Build Phase to your extension's target. Copy and paste the one in your main app.
- Add the Fabric and Crashlytics.framework to your extension's linked libraries
Add the
Crashlytics.startWithAPIKey("YourActualApiKey")
to your extension's view controller'sinitWithCodermethod
. If you don't have aninitWithCoder
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