我有一个 flutter 应用程序,它在调试模式下工作得很好,但是在发布模式下运行时,它可以工作但不会从 firestore 中获取数据,并且没有错误消息或任何东西......这个是获取数据的方法:
Future<List<SectionModel>?> showSections() async {
var userInfo = await udb.getUserInfo();
List<String> userCode = userInfo != null ? userInfo.codes : [];
List<SectionModel> sections = [];
try {
var sectionInfo = await _coursesCollection.where("sectionCode", whereIn: userCode).get();
var data = sectionInfo.docs
.map((section) => SectionModel?.fromMap(section.data()))
.toList();
if(data.isNotEmpty) {
sections = data;
return sections;
} else {
return [];
}
} on Exception catch (e) {
Warnings.showSnackBar(
"db problem", "could not fetch the section information !!");
}
}
仅在发布模式下,应用程序在 Snackbar 中向我显示此消息:“数据库问题”、“无法获取部分信息 !!....
这是 firestore 中的安全规则,我在我的应用中使用了电话身份验证:
rules_version = '2';
// Allow read/write access on all documents to any user signed in to the application
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
这是我在 Logcat(错误)中发现的一部分:
2021-06-18 12:33:06.441 3945-4040/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
2021-06-18 12:33:06.547 3844-23251/? E/AudioFlinger: stageIndex is 0, get default sink buf
2021-06-18 12:33:07.751 4308-4417/? E/MotionRecognitionService: handleMessage: event 200 value : 1
2021-06-18 12:33:15.066 4308-4935/? E/Watchdog: !@Sync 2751 [2021-06-18 12:33:15.065] FD count : 563
2021-06-18 12:33:17.617 14880-27368/? E/memtrack: Couldn't load memtrack module
2021-06-18 12:33:18.181 4308-4417/? E/MotionRecognitionService: handleMessage: event 200 value : 1
2021-06-18 12:33:45.084 4308-4935/? E/Watchdog: !@Sync 2752 [2021-06-18 12:33:45.084] FD count : 563
2021-06-18 12:34:06.445 3945-4040/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
2021-06-18 12:34:15.098 4308-4935/? E/Watchdog: !@Sync 2753 [2021-06-18 12:34:15.098] FD count : 563
2021-06-18 12:34:28.091 327-327/? E/fb4a.MsysMqttTopicsProvider: subscribing to mqtt
2021-06-18 12:34:29.899 15003-23169/? E/AuthPII: [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: Account {name=osama@itdar.com, type=com.google}, App: com.android.vending, Service: oauth2:https://www.googleapis.com/auth/googleplay
uto: Long live credential not available.
at hnx.a(:com.google.android.gms@212116028@21.21.16 (100400-378233385):13)
at hoa.e(:com.google.android.gms@212116028@21.21.16 (100400-378233385):1)
at hml.l(:com.google.android.gms@212116028@21.21.16 (100400-378233385):44)