當我撰寫我的顫振應用程式時,我在 macOs 上遇到了這個問題,相同的基本代碼在我的 windows pc 中作業,但在 macOs 中它不起作用。正如您在我的日志中看到的,應用程式已連接,但我仍然無法在我的 Firestore 資料庫上發出請求
我改變了規則
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
到
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
但我有同樣的錯誤。
D/FirebaseAuth(11790): Notifying id token listeners about user ( tNGS8j375AYehEPDhZADPP80zLY2 ).
W/DynamiteModule(11790): Local module descriptor class for providerinstaller not found.
I/DynamiteModule(11790): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller(11790): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
W/Firestore(11790): (24.0.0) [Firestore]: Listen for Query(target=Query(usersProDEV where uuid == tNGS8j375AYehEPDhZADPP80zLY2 order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
E/flutter (11790): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.
相同的代碼在我的 Windows PC 中作業
uj5u.com熱心網友回復:
在里面projectFolder/android/app/src/main/AndroidManifest.xml添加以下內容:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
uj5u.com熱心網友回復:
根據這篇文章,您的應用程式訪問互聯網時出現錯誤。請檢查您的網路連接:
檢查您在 androidManifest 檔案中是否具有正確的 Internet 權限(由 Abhishek Dutt 建議)。
如果您使用的是模擬器,請檢查模擬器是否可以使用此帖子訪問互聯網。
第 1 版:
您能否嘗試本檔案中的示例代碼進行身份驗證:
service cloud.firestore {
match /databases/{database}/documents {
match /messages/{document=**} {
allow read, update, delete: if request.auth.uid == resource.data.uid;
allow create: if request.auth.uid != null;
}
}
}
此代碼必須僅適用于讀取而不是寫入:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if false;
}
}
}
uj5u.com熱心網友回復:
幾次之后,我意識到問題不僅在 MacOs 下,而且在模擬器上。通過進一步挖掘,我意識到我在專案上激活的 AppCheck 不接受模擬器下除錯模式的所有請求。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/413782.html
標籤:
上一篇:Java錯誤:JDK17.0.1無法在此計算機上安裝
下一篇:如何為復雜型別的列分配空值?
