簡體   English   中英

我如何將 Firebase Firestore 連接到我的 swift 應用程序

[英]How do i connect the firebase Firestore to my swift app

我在網上嘗試了許多不同的資源,但它們似乎都使用了應用程序委托文件,我完全感到困惑。

我想要做的就是從雲 Firestore 讀取和寫入我的 swift 應用程序

我已經通過包管理安裝了 firebase 和 firestore,但似乎找不到 Forestore Manager

 import SwiftUI
import Firebase

@main

struct RecipyApp: App{
    
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    @StateObject var firestoreManager = FirestoreManager()

    
    var body: some Scene{
        let viewModel = AppViewModel()
        WindowGroup{
            ContentView()
                .environmentObject(viewModel)
                .environmentObject(firestoreManager)
   
                
        }
        
    }
    
}

class AppDelegate: NSObject, UIApplicationDelegate{
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        
        FirebaseApp.configure()
        
        
        return true
        
    }
}

我的代碼。

我能做些什么來解決我的問題?

非常感謝

解決方案 1:刪除多余的包並運行應用程序 解決方案 2:轉到 Xcode Preference > Location ,刪除派生數據

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM