首页 文章

错误:使用未解析的标识符'FIRApp'

提问于
浏览
0

我一直收到错误使用未解析的标识符'FIRApp' . 我删除了我的派生数据文件夹,更新了pod,并多次重新安装了pod . 我目前正在使用xcode 8.2.1 . 我的pod版本是使用Firebase(3.14.0)使用FirebaseAnalytics(3.7.0)使用FirebaseCoreID(3.5.1)使用FirebaseInstanceID(1.0.9)使用FirebaseMessaging(1.2.2)使用GoogleToolboxForMac(2.1.1)使用Protobuf(3.2.0) .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
        }

1 回答

  • 1

    我有同样的问题并解决了它在命令行上执行以下步骤:

    • pod repo更新

    • 从我的Podfile中注释了pod 'Firebase'行

    • pod install(这删除了旧的Firebase)

    • 再次添加了pod 'Firebase'行 .

    • pod install(添加了新的Firebase)

相关问题