bounty将在2小时后到期。回答此问题可获得+100声望奖励。Chris希望引起更多关注此问题。
我在这里失去了理智...我测试了我的Flutter应用程序,使用Firebase,一切都运行得很好。在每个模拟器上,在真实的设备上,在TestFlight中。一切都在工作。
但是苹果的评论者在试图上传东西到Firebase时总是出错,但是error
只说:
an unknown error occurred please check the server response
这就是error
发生的地方:
Future<Memory?> addMemory({
required BuildContext context,
required String title,
required List<String> imageFilePaths,
required DateTime dateTime,
required String? story,
int? sortIndexIfEditing,
}) async {
try {
Year currentYear =
Provider.of<DataProvider>(context, listen: false).getCurrentYear();
Month currentMonth =
Provider.of<DataProvider>(context, listen: false).getCurrentMonth();
int currentMonthIndex = currentMonth.month;
String uid = AuthService.currentUser!.uid;
List<String> imageLocations = [];
for (String path in imageFilePaths) {
String uidForLocation = Uuid().v1();
String imageLocation =
'$uid/${currentYear.id}/${currentMonth.id}/$uidForLocation';
await FirebaseStorage.instance.ref(imageLocation).putFile(
File(path),
);
imageLocations.add(imageLocation);
}
Memory? memoryToReturn = await _addMemoryToDatabse(
context: context,
imageLocations: imageLocations,
currentYear: currentYear,
currentMonthIndex: currentMonthIndex,
title: title,
dateTime: dateTime,
story: story,
sortIndexIfEditing: sortIndexIfEditing,
);
return memoryToReturn;
} on FirebaseException catch (e) {
print('addMemory failed: ' + e.message.toString());
AlertService.showSnackBar(
title: 'Ups, hier ist etwas schiefgelaufen...',
description: e.message.toString(),
isSuccess: false,
);
return null;
}
}
这不是关于Security Rules
,已经检查过:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
这个error
还能代表什么呢?我希望我能提供更多的信息,但这就是我所知道的。
如果你想访问TestFlight,请告诉我你的电子邮件地址,这样你就可以自己测试了。
1条答案
按热度按时间0pizxfdo1#
正如Frank所建议的,这是Firebase Storage的一个已知问题。
这是关于同一个案例的另一个SO问题:
App Store review team reports 'Connection refused' error preventing image loading when using Firebase storage
顺便说一句,我的应用程序刚刚被接受。我将我的
Security Rules
更改为allow read, write: if true
,这是你不应该这样做的。在它被接受后,我将其更改回安全规则。我不知道是否有一个实际的
auth
问题,因为我的Firebase-Log
没有显示任何拒绝。