我使用Firestore,fcm和firebase cloud storge设置了颤抖的应用程序,在Android上效果很好,在ios上,我已经从xcode向Runner添加了GoogleService-Info.plist,在我的main.dart上也称为from django.contrib.auth import get_user_model
class UserPostListView(ListView):
model = Post
template_name = 'user_posts.html'
context_object_name = 'posts'
queryset = Post.objects.filter(admin_approved=True)
paginate_by = 6
def get_queryset(self, *args, **kwargs):
return super().get_queryset(*args, **kwargs).filter(
designer__username=self.kwargs['username']
).order_by('-date_posted')
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['designer'] = designer = get_object_or_404(
get_user_model(),
username=self.kwargs['username']
)
context['has_items'] = Item.objects.filter(designer=designer).exists()
return context
在Android Firestore和存储上工作良好,我能够CRUD数据,上传文件,但是当我尝试将媒体上传到Firebase上时
带有此代码的ios
await Firebase.initializeApp();
正常运行时,ios应用程序异常崩溃,控制台上未打印任何内容 但是当在详细模式下运行时,我看到此记录了
Future uploadFile(int index, int type) async {
String fileName =
DateTime.now().millisecondsSinceEpoch.toString() + "${widget.userId}";
StorageReference reference = FirebaseStorage.instance.ref().child(fileName);
StorageUploadTask uploadTask = reference.putFile(File(images[index]));
StorageTaskSnapshot storageTaskSnapshot = await uploadTask.onComplete;
storageTaskSnapshot.ref.getDownloadURL().then((downloadUrl) {
setState(() {
isLoading = false;
imageUrl = downloadUrl;
});
}, onError: (err) {
setState(() {
isLoading = false;
});
});
}
还使用Google列表中的REVERSED_CLIENT_ID将[+123976 ms] Service protocol connection closed.
[ +1 ms] Lost connection to device.
[ +35 ms] DevFS: Deleting filesystem on the device
(file:///Users/Me/Library/Developer/CoreSimulator/Devices/12E19722-CC83-452B-B263-EF624D069BED/dat
a/Containers/Data/Application/BC48EA57-B913-4281-9628-59C783B0FE77/tmp/r2a_mobile28vRsI/r2a_mobile/)
[ +258 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not
completed
[ +4 ms] "flutter run" took 223,298ms.
[ +271 ms] ensureAnalyticsSent: 264ms
[ +2 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +7 ms] Shutdown hooks complete
[ +2 ms] exiting with code 0
添加到了我的info.plist中
pubspec上的Firebase软件包:
<key>CFBundleURLSchemes</key>
Flutter版本:
firebase_core: ^0.5.0
cloud_firestore: ^0.14.0+2
firebase_storage: ^4.0.0
firebase_messaging: ^7.0.0
我真的需要一些帮助 在此先感谢