导致“线程1:信号SIGABRT”的Firebase [英] Firebase causing "Thread 1: signal SIGABRT"

查看:360
本文介绍了导致“线程1:信号SIGABRT”的Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

在控制台它说:libc ++ abi.dylib:终止与NSException类型的未捕获的异常
(11db)

Xcode 8.2,swift 3

  import UIKit 
import Firebase

@UIApplicationMain $ b $ class AppDelegate:UIResponder,UIApplicationDelegate {

var window:UIWindow?


func application(_ application:UIApplication,didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey:Any]?) - > Bool {
//在应用程序启动后替代自定义点。
FIRApp.configure()

返回true
}

func applicationWillResignActive(_ application:UIApplication){
//当应用程序即将从活动状态转移到非活动状态。对于某些类型的临时中断(例如来电或SMS消息)或用户退出应用程序并开始转换到后台状态时,可能会发生这种情况。
//使用此方法暂停正在进行的任务,禁用定时器,并使图形呈现回调无效。游戏应该使用这种方法来暂停游戏。

$ b $ func applicationDidEnterBackground(_ application:UIApplication){
//使用此方法释放共享资源,保存用户数据,使计时器无效并将足够的应用程序状态信息存储到如果稍后终止,则将应用程序恢复到当前状态。
//如果您的应用程序支持后台执行,则调用此方法而不是applicationWillTerminate:当用户退出时。


func applicationWillEnterForeground(_ application:UIApplication){
//作为从背景转换到活动状态的一部分;在这里你可以撤消进入背景的许多变化。


func applicationDidBecomeActive(_ application:UIApplication){
//在应用程序处于非活动状态时,重新启动暂停(或尚未启动)的任何任务。如果应用程序以前位于后台,则可以选择刷新用户界面。


func applicationWillTerminate(_ application:UIApplication){
//当应用程序即将终止时调用。保存数据,如果适用。另请参阅applicationDidEnterBackground :.

code










$ b $ p


$ b

Podfile

 #取消注释下一行为您的项目定义全局平台
#platform:ios,'9.0'

target'dur2'do
#如果你不使用Swift而不想使用动态框架,注释下一行
use_frameworks!

#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'



结束

解决方案

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



在创建pod文件的步骤中,确保你在你的项目文件夹中,并使用这个文本:

pre $ #取消注释下一行为你的项目定义一个全局平台
#platform:ios,'9.0'

target'your-project-name'do
#如果你不使用Swift并不想使用动态框架
use_frameworks!

#Firebox
pod'Firebase / Core'
end

并将您的项目名称替换为您的项目名称



保存文件,然后执行



  pod install 



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


I started a blank Xcode project and all I did was add the Firebase framework via Cocoapods and import in the Appdelegate and viewcontroller. When I add FIRApp.configure() to didFinishLoadingWithOptions I get that error. If I remove that line but still have the framework imported it runs with no errors. This happens on a blank project with nothing in the storyboard nor viewcontroller.swift.

In the console it says libc++abi.dylib: terminating with uncaught exception of type NSException (11db)

Xcode 8.2, swift 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:.
}

}

Podfile

    # 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'

end

解决方案

Let's try a test.

Create a new project following the instructions on the Firebase website, ensuring you add the GoogleService-Info.plist to your project.

At the step where you create a pod file, make sure you are in your projects folder and use this text:

# 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

and put your project name in place of your-project-name

Save the file and then do a

pod install

Then open the project-name.xcworkspace and build it.

这篇关于导致“线程1:信号SIGABRT”的Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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