swift - 为什么我会收到错误 : Value of type 'Auth' has no member 'useEmulator'

标签 swift firebase firebase-authentication google-cloud-functions

我正在关注 this尝试设置 Firebase 模拟器套件的教程。但是,我收到以下错误:“Auth”类型的值没有成员“useEmulator”。这是我的代码:

import UIKit
import Firebase
import IQKeyboardManager

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        FirebaseApp.configure()
        // code block used for local testing where error is showing
        let settings = Firestore.firestore().settings
        settings.host = "localhost:8080"
        settings.isPersistenceEnabled = false
        settings.isSSLEnabled = false
        Firestore.firestore().settings = settings
        Functions.functions().useFunctionsEmulator(origin: "http://localhost:5001")
        Auth.auth().useEmulator(withHost:"localhost", port:9099)
        //
        IQKeyboardManager.shared().isEnabled = true
        
        return true
    }

    // MARK: UISceneSession Lifecycle

    @available(iOS 13.0, *)
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    @available(iOS 13.0, *)
    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }


}

播客文件:

# Uncomment the next line to define a global platform for your project
 platform :ios, '12.0'


target 'Pikit' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Pikit
    pod 'Firebase'
    pod 'Firebase/Storage'
    pod 'Firebase/Auth'
    pod 'Firebase/Functions'
    pod 'Firebase/Firestore'
    pod 'Firebase/Analytics'
    pod 'Firebase/Messaging'
    pod 'Firebase/DynamicLinks'
    pod 'FirebaseUI', '~> 8.0'
    pod 'FirebaseUI/Google'
    pod 'FirebaseUI/Facebook'
    pod 'FirebaseUI/OAuth' # Used for Sign in with Apple, Twitter, etc
    pod 'FirebaseUI/Phone'
    pod 'IQKeyboardManager' # Auto move screen for keyboard
    pod 'SDWebImage', :modular_headers => true
    pod 'PureLayout'
  
end

我已尝试构建和清理我的文件夹,但没有成功。我认为我没有将提供的代码放在正确的位置,但文档中没有指示它应该放在哪里。

最佳答案

这件事发生在我身上,我发现我的 firebase pod 已经完全过时了。在我更新到最新版本后解决了(目前对我来说它是 Firebase/Auth 的 8.12)

关于swift - 为什么我会收到错误 : Value of type 'Auth' has no member 'useEmulator' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65064019/

相关文章:

swift - 如何在 SwiftUI 中创建字符串的大写版本?

Firebase/数据库 - 版本 2 安全规则?

android - Firebase 升级到 9.2.0 后同步项目时出错

ios - 将 Facebook 登录与 Parse 集成

arrays - Swift - 从文件读取/写入数组数组

ios - 如何为 Swift 配置 Firebase 并读取数据

ios - 基本 Swift 3 应用程序因 Firebase 崩溃

android - 如何摆脱 Android Studio 警告 "Result of getException() not thrown"?

android - “com.google.android.gms.common.api.GoogleApiClient”已弃用

Swift2 UI 测试 - 等待元素出现