导致“线程1:信号SIGABRT”的Firebase
我开始了一个空白的Xcode项目,我所做的只是通过Cocoapods添加Firebase框架并在Appdelegate和viewcontroller中导入。当我添加FIRApp.configure()到didFinishLoadingWithOptions我得到那个错误。如果我删除该行,但仍然导入框架,它运行没有错误。这发生在一个空白项目中,故事板中没有任何内容,也没有viewcontroller.swift。导致“线程1:信号SIGABRT”的Firebase
在它说控制台的libC++ abi.dylib:与类型NSException的未捕获的异常 (11分贝)结束
的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:.
}
}
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
让我们来试一下。
按照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
和到位的您的项目名称
把你的项目名称保存文件,然后做一个
pod install
然后打开项目name.xcworkspace并构建它。
如果您还没有,
转到您的firebase项目并下载google.plist文件并将其添加到您的项目并运行。
就职于Xcode的9
如果没有解决方案的工作了,你试试这个:
- 关闭的Xcode
-
在Finder:
- 删除.xcworkspace文件
- 删除Podfile。锁定文件
- 删除荚文件夹
在终端(项目文件夹中):吊舱安装
确保GoogleService-Info.plist中被添加到您的目标并为您的BUNDLE_ID生成。
不知什么原因,当您同时使用“火力地堡/ AdMob广告”和“火力地堡/芯”豆荚的Xcode可以搞砸了工作区,并产生不好的构建,如果您尝试在运行时会崩溃调用FirebaseApp.configure()或GADMobileAds.configure(withApplicationID: “APP_ID”)
你加googleplist文件? – Ro4ch
您是否为Firebase添加.plist文件? –
是的,我做了@ Ro4ch – Henry