gpt4 book ai didi

ios - 如何以编程方式将现有 GCP 存储桶集成/访问到 Firebase Swift 应用程序?

转载 作者:行者123 更新时间:2023-11-29 13:54:21 25 4
gpt4 key购买 nike

我使用 Node.js 库在 GCP 存储上创建存储桶。稍后,我想从我的 Firebase iOS 应用访问这些 GCP 存储桶。然而,我做不到。尝试从我的 iOS 应用程序访问我现有的 GCP 存储桶时收到以下错误:

您的存储桶没有为 Firebase 存储正确设置。请访问 https://console.firebase.google.com/project/MY_PROJECT/storage/files 自动修复此问题,然后重试。如果问题持续时间超过五分钟,您可能没有足够的权限来修复项目。您可以访问 https://console.firebase.google.com/iam-admin/iam/project?project=MY_PROJECT 检查您的权限。”

我似乎需要转到 Firebase 存储控制台并手动将现有的 Google 云存储存储桶导入我的 Firebase 项目(建议 here)。

如何以编程方式将现有 GCP 存储桶导入我的 iOS Firebase 项目?或者,是否可以使用 Firebase 存储库从我的 iOS 应用程序访问现有 GCP 存储桶并对其执行操作?

注意:我使用的是 Blaze 计划。 firebase-storage@system.gserviceaccount.com 作为存储管理员添加到我现有的 GCP 存储桶中,就像我的默认 Firebase 存储存储桶一样。

这是 Firebase 控制台的屏幕截图,解释了这种情况。 Firebase Screenshot

最佳答案

我找到了一份关于 The Firebase integration with Google Cloud Platform 的文档.它说:

Cloud Storage for Firebase is tightly integrated with Google Cloud Platform. The Firebase SDKs for Cloud Storage store files directly in Google Cloud Storage buckets.

这意味着尝试从您的应用调用 GCS 存储桶时应该不会出现问题。有多种方法可以访问存储在您的 Cloud Storage 存储桶中的数据,具体取决于您想要做什么。

对于集成本身,我找到了这个 GCS buckets and Firebase Quickstart .是的,它提到您需要指定存储桶的位置。

据说

Read and write access to Storage is restricted so only authenticated users can read or write data

这意味着您必须在您的应用程序中实现身份验证过程。还要检查 Firebase authentication所以我们也可以去掉 insufficient permissions 部分。

希望对您有所帮助。

编辑:也许我忘了提到 Security Rules .设置它们后,您的应用程序(和您的用户)将有权访问您的 GCS 存储桶。我还发现了一个非常相似的案例here .

关于ios - 如何以编程方式将现有 GCP 存储桶集成/访问到 Firebase Swift 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57659112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com