iOS(Fabric):Crashlytics在发布时崩溃应用程序

时间:2016-09-27 05:56:31

标签: ios objective-c swift crashlytics twitter-fabric

我已更新了Crashlytics,但我仍然在启动时收到此错误:

  

错误:***由于未捕获的异常'FABException'而终止应用,   原因:'[Fabric]看来“Crashlytics”不是一个有效的Fabric   工具包。请确保您只将Fabric Kits传递给[Fabric with:]。

这是我的代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

         Fabric.with([Crashlytics.self])
         return true
    }

4 个答案:

答案 0 :(得分:1)

花了7个小时后,我能够解决问题。问题是:我的代码中有2个Crashlytics文件导致了这个问题。为了解决这个问题,我删除了旧文件并再次集成了Crashlytics。

答案 1 :(得分:1)

我在同一行发生崩溃,这是因为我在FirebaseApp.configure()之前将其称为“崩溃”。

对于遇到相同问题的任何人,请确保按以下顺序致电他们:

FirebaseApp.configure()
Fabric.with([Crashlytics.self])

答案 2 :(得分:0)

试试这个: -

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
      Fabric.with([Crashlytics.self])
      return true
    }

答案 3 :(得分:0)

尝试下面的代码段,它可能会有所帮助:

对于Swift:

//import related frameworks

import Fabric

import Crashlytics

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {

    Fabric.with([Crashlytics()])
    //... your initialization code
    return true
}

对于Objective-C:

#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
     [Fabric with:@[CrashlyticsKit]];
     //... your initialization code
   return YES;
}