Flutter Firebase 实时访问被拒绝错误

问题描述 投票:0回答:1

我大约三周前发布了一个新版本。一切都工作正常,直到一些 iOS 设备卡在启动屏幕中。当我在 Mac 上调试此问题时,出现此错误:

flutter:[firebase_database/permission-denied] 客户端无权访问所需数据。

当我在 Android 中运行该应用程序时,它工作正常。此外,iPad 或 iPhone 13 等某些设备上也会出现这种情况。iPhone 14 上有时也会出现这种情况,但它会自动再次开始正常运行。

当我更改 Wifi 或移动数据时,应用程序会在 iOS 设备中再次开始运行。这些是我在实时数据库规则中使用的权限:

{
  "rules": {
    ".read": true,
    ".write" : true,
  }
}

如果我的应用程序代码存在问题,那么我们应该在发布应用程序后就遇到此问题。

  • 我已经检查了firebase中的权限,它们也很好。
  • 这只发生在某些 iOS 设备上。
  • 我已将 flutter 版本升级到 3.16.0,还升级了所有软件包,包括 firebaseCore 等。
ios flutter firebase firebase-realtime-database ipad
1个回答
0
投票
you should try this once ,you might want to restrict access to authenticated users only:


{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null",
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.