Swift 错误:使用未解析的标识符';FIRApp&x27;

Swift 错误:使用未解析的标识符';FIRApp&x27;,swift,xcode,firebase,xcode8,firebase-cloud-messaging,Swift,Xcode,Firebase,Xcode8,Firebase Cloud Messaging,我一直在使用未解析标识符“FIRApp”时出错。我已经删除了我的衍生数据文件夹,更新了播客,并多次重新安装了播客。我目前使用的是xcode 8.2.1。我的吊舱版本是 使用Firebase(3.14.0) 使用FirebaseAnalytics(3.7.0) 使用FirebaseCore(3.5.1) 使用FirebaseInstanceID(1.0.9) 使用FirebaseMessaging(1.2.2) 使用Google ToolboxFormac(2.1.1) 使用Protobuf(3.

我一直在使用未解析标识符“FIRApp”时出错。我已经删除了我的衍生数据文件夹,更新了播客,并多次重新安装了播客。我目前使用的是xcode 8.2.1。我的吊舱版本是 使用Firebase(3.14.0) 使用FirebaseAnalytics(3.7.0) 使用FirebaseCore(3.5.1) 使用FirebaseInstanceID(1.0.9) 使用FirebaseMessaging(1.2.2) 使用Google ToolboxFormac(2.1.1) 使用Protobuf(3.2.0)。我正在使用最新版本的cocoapods。谢谢你的帮助

import UIKit
    import UserNotifications
    import Firebase
    import FirebaseInstanceID
    import FirebaseMessaging

    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {

        var window: UIWindow?
        let gcmMessageIDKey = "gcm.message_id"

        func application(_ application: UIApplication,
                         didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

            // Register for remote notifications. This shows a permission dialog on first run, to
            // show the dialog at a more appropriate time move this registration accordingly.
            // [START register_for_notifications]
            if #available(iOS 10.0, *) {
                // For iOS 10 display notification (sent via APNS)
                UNUserNotificationCenter.current().delegate = self

                let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
                UNUserNotificationCenter.current().requestAuthorization(
                    options: authOptions,
                    completionHandler: {_, _ in })

                // For iOS 10 data message (sent via FCM)
                FIRMessaging.messaging().remoteMessageDelegate = self

            } else {
                let settings: UIUserNotificationSettings =
                    UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
                application.registerUserNotificationSettings(settings)
            }

            application.registerForRemoteNotifications()

            // [END register_for_notifications]
            FIRApp.configure()

            // [START add_token_refresh_observer]
            // Add observer for InstanceID token refresh callback.
            NotificationCenter.default.addObserver(self,
                                                   selector: #selector(self.tokenRefreshNotification),
                                                   name: .firInstanceIDTokenRefresh,
                                                   object: nil)
            // [END add_token_refresh_observer]
            return true
        }

我遇到了同样的问题,并通过在命令行上执行以下步骤解决了它:

  • pod回购更新
  • 评论了我的播客文件中的播客“Firebase”行
  • 吊舱安装(拆除了旧的Firebase)
  • 再次添加了吊舱“火力基地”线
  • pod安装(添加了新的Firebase)