【问题标题】:Firebase causing "Thread 1: signal SIGABRT"Firebase 导致“线程 1:信号 SIGABRT”
【发布时间】:2017-05-10 13:18:46
【问题描述】:

我开始了一个空白的 Xcode 项目,我所做的只是通过 Cocoapods 添加 Firebase 框架并导入 Appdelegate 和 viewcontroller。当我将 FIRApp.configure() 添加到 didFinishLoadingWithOptions 时,我收到了该错误。如果我删除了该行但仍然导入了框架,它将运行没有错误。这发生在一个空白项目中,情节提要和 viewcontroller.swift 中没有任何内容。

在控制台中显示 libc++abi.dylib: terminating with uncaught exception of type NSException (11db)

Xcode 8.2,快速 3

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
 FIRApp.configure()

    return true
}

func applicationWillResignActive(_ application: UIApplication) {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

}

播客文件

    # Uncomment the next line to define a global platform for your        project
    # platform :ios, '9.0'

    target 'dur2' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!

      # Pods for dur2

pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'Firebase/Messaging'
pod 'Firebase/Database'
pod 'Firebase/Invites'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Crash'
pod 'Firebase/RemoteConfig' 
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'SDWebImage'

结束

【问题讨论】:

  • 您添加了 googleplist 文件吗?
  • 您是否为 Firebase 添加了 .plist 文件?
  • 文件添加到正确的目标了吗?
  • 您是否在文件中导入了 Firebase?
  • 是的,它已添加到正确的目标 @ro4ch

标签: ios swift xcode firebase


【解决方案1】:

让我们尝试一下。

按照 Firebase 网站上的说明创建一个新项目,确保将 GoogleService-Info.plist 添加到您的项目中。

在创建 pod 文件的步骤中,确保您位于项目文件夹中并使用以下文本:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'your-project-name' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Firesearch
  pod ‘Firebase/Core’
end

并将您的项目名称替换为 your-project-name

保存文件然后做一个

pod install

然后打开 project-name.xcworkspace 并构建它。

【讨论】:

  • 好的,我做到了,并在我的设备上运行了它,没有出现任何错误,我的 Firebase 控制台确认应用安装。从这里我只能认为我安装的额外 pod 导致了错误,有什么想法吗?
  • 如何删除我在之前项目中安装的额外 pod?
  • @Henry 好吧,您可以试试Automated App,这可能会有所帮助。除此之外,它们必须手动删除。您也可以尝试从 podfile 中删除 pod,然后再次运行 pod install。
【解决方案2】:

曾为 Xcode 9 工作

如果没有一个解决方案适合你,试试这个:

  1. 关闭 Xcode
  2. 在查找器中:

    • 删除 .xcworkspace 文件
    • 删除 Podfile.lock 文件
    • 删除 Pods 文件夹
  3. 在终端中(在项目文件夹中):pod install

  4. 确保将 GoogleService-Info.plist 添加到您的目标并为您的 BUNDLE_ID 生成。

当您同时使用 "Firebase/Admob""Firebase/Core" pod 时,由于未知原因,Xcode 可能会弄乱工作空间并生成会崩溃的糟糕构建如果您尝试在运行时调用 FirebaseApp.configure()GADMobileAds.configure(withApplicationID: "APP_ID")

【讨论】:

    【解决方案3】:

    如果你还没有,

    在 firebase 中转到您的项目并下载 google.plist 文件并将其添加到您的项目中并运行。

    【讨论】:

      【解决方案4】:

      我遇到了同样的问题,我通过使用另一个 gmail 帐户解决了这个问题。在 firebase 上创建一个新项目,然后创建一个数据库并将您的 ios 应用添加到 firebase 数据库(确保将 GoogleService-Info.plist 添加到您的目标并为您的 BUNDLE_ID 生成。)

      【讨论】:

        【解决方案5】:

        我已经拉头发 2 天了...

        这是我发现的

        1. 确保您拥有正确的 GoogleService-info.plist 文件 启用 .plist 文件。
        2. 将文件指向您的目标应用程序 plist target to your app

        【讨论】:

          【解决方案6】:

          不要将 GoogleService-Info.plist 复制到您的项目中,只需将 GoogleService-Info.plist 拖放到 ios/appName,然后检查是否需要复制选项.

          【讨论】:

            【解决方案7】:

            对于 Swift 4 和 Xcode 10:

            删除 XC 工作区、podfile.lock、podfile 和 pod 文件夹。然后重新安装 pod 并从新的 XC 工作区开始。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2021-05-29
              • 1970-01-01
              • 1970-01-01
              • 2018-11-05
              相关资源
              最近更新 更多