ios - 使用未解析的标识符 'FIRApp'

标签 ios swift swift2 xcode7 firebase-cloud-messaging

我已经使用 cocoa pod 在我的 iOS 应用程序中实现了 Firebase。问题是当我尝试配置 firebase 时,出现此错误 Use of unresolved identifier 'FIRApp'。当我在 appdelegate 文件中使用代码 FIRApp.configure() 时会发生此错误。谁能帮我解决这个问题?

import UIKit
import AWSCore
import GoogleMaps
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  let defaults = NSUserDefaults.standardUserDefaults()

  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    // Use Firebase library to configure APIs
    FIRApp.configure()
    return true
  }
}

我已遵循 Firebase 指南 https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app

这是pod文件

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
use_frameworks!

target 'xxxx' do
     pod 'SwiftyJSON', :git =>       'https://github.com/SwiftyJSON/SwiftyJSON.git'
     pod 'DKChainableAnimationKit'
     pod 'Charts'
     pod 'JVFloatLabeledTextField'
     pod 'AWSAutoScaling'
     pod 'AWSCloudWatch'
     pod 'AWSCognito'
     pod 'AWSDynamoDB'
     pod 'AWSEC2'
     pod 'AWSElasticLoadBalancing'
     pod 'AWSKinesis'
     pod 'AWSMobileAnalytics'
     pod 'AWSS3'
     pod 'AWSSES'
     pod 'AWSSimpleDB'
     pod 'AWSSNS'
     pod 'AWSSQS'
     pod 'GoogleMaps'
     pod 'Firebase'
end

最佳答案

我已经尝试了所有的答案,但是在头痛了 2 个小时之后......我找到了这个

在 AppDelegate.m 文件中,您应该在 #ifdef FB_SONARKIT_ENABLED 行之前像 #import 一样导入 firebase。

据我所知,您可能会在开发构建上取得成功,因为 FlipperKit 库用于调试,如果满足条件,则使用此#ifdef FB_SONARKIT_ENABLED。当您尝试存档时,它不会被导入并且变量将未声明,因为 #import 仍处于该 if 条件。

关于ios - 使用未解析的标识符 'FIRApp',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38009174/

相关文章:

ios - PlaygroundPage没有成员(member)评估状态

ios - UITableView 与单元格中的图像卡住

ios - 错误 :'inout IndexPath' 不可转换为 'IndexPath'

ios - 从首选项包中读取 BOOL 值

ios - 从 GameViewController 调用 SKScene 方法

ios - 从我的 Parse 数据库中获取任意数量的 UserID 的最快方法

ios - 类型 'UITouch' 的值没有成员 'locationInNode'

ios - 文本字段 shouldChangeCharactersInRange 未调用

iOS 9 推送通知在应用程序打开时不显示

ios - Phonegap - 打开/复制 PDF 文件到 iBook