2017-03-03 28 views
0

我一直收到錯誤使用未解析標識符'FIRApp'。我刪除了我的派生數據文件夾,更新了窗格,並重新安裝了多次窗格。我目前正在使用xcode 8.2.1。我莢版本 使用火力地堡(3.14.0) 使用FirebaseAnalytics(3.7.0) 使用FirebaseCore(3.5.1) 使用FirebaseInstanceID(1.0.9) 使用FirebaseMessaging(1.2.2) 使用GoogleToolboxForMac(2.1。 1) 使用Protobuf(3.2.0)。我正在使用最新版本的cocoapods。感謝您的幫助。錯誤:使用未解析標識符'FIRApp'

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

我有同樣的問題,並解決它做在命令行中執行以下步驟:從我的Podfile

    1. 莢回購更新
    2. 評論莢「火力地堡」線安裝(這刪除了舊的Firebase)
    3. 再次添加了「Firebase」線。
    4. pod安裝(添加了新的Firebase)
  • 相關問題