简体   繁体   English

Swift - 使用 URLSessionStreamTask 使我的应用程序与 Firebase 数据库数据保持同步

[英]Swift - Using URLSessionStreamTask to keep my app in sync with Firebase DB data

I came across this link trying to figure out how to access the REST api of my firebase database and stream it to my app.我遇到这个链接试图弄清楚如何访问我的 firebase 数据库的 REST api 和 stream 它到我的应用程序。 I can get/send data manually, but for my app I can't use the firebase api (because it is an app clip), so I'm trying to do it with native tools and rest, but the issue I'm running into is getting the configuration right (per this info ) and actually parsing the incoming info and updating my app.我可以手动获取/发送数据,但对于我的应用程序,我不能使用 firebase api(因为它是一个应用程序剪辑),所以我正在尝试使用本机工具和 rest,但我正在运行的问题into 正在正确配置(根据此信息)并实际解析传入信息并更新我的应用程序。 I'm so lost and could use some help just figuring out how to make the code in the sample work, especially since I'm using swift ui as well.我很迷茫,可以使用一些帮助来弄清楚如何使示例中的代码工作,尤其是因为我也在使用 swift ui。

Any help is appreciated, thanks!任何帮助表示赞赏,谢谢!

Apparently App Clips do not allow sockets connections, so (while Google rewrites their sdk to comply), I migrated my database to Realtime Database (since it was a better fit for us usage-wise), and have been using standard rest for sending and getting data, and for the "listener" functionality I have been using IKEventSource that listens to server-side events and updates them accordingly in my app clip.显然 App Clips 不允许 sockets 连接,所以(虽然谷歌重写了他们的 sdk 以符合要求),我将我的数据库迁移到实时数据库(因为它更适合我们使用),并且一直使用标准 rest 发送和获取数据,对于“侦听器”功能,我一直在使用IKEventSource来侦听服务器端事件并在我的应用程序剪辑中相应地更新它们。 Seems to be a pretty good workaround so far.到目前为止似乎是一个很好的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想使用 swift 获取我的 firebase(不是密钥)的孩子 - I want to get the child of my firebase (not the key) using swift 如何使用 Firebase 身份验证保持用户登录 Flutter web 应用程序 - How to keep a user logged in Flutter web app using Firebase Authentication 添加 firebase 数据库后,我的应用程序一直崩溃 我在 android studios 中不断收到应用程序的编译错误 - My app keeps crashing after I added a firebase database I keep getting a compile error with app in android studios Firebase Crashlytics 不与我的 android 项目同步 - Firebase Crashlytics do not sync with my android project 从 swift 中检索 firebase 数据 - Retrieve firebase data from swift 当我从 firebase 导入 {db} 时,为什么我的 React 应用程序 go 空白? - Why does my react app go blank when I import {db} from firebase? Firebase 数据未显示在 flutter 应用程序中 - Firebase data not displaying in flutter app 如何使用 swift 在 firebase 上上传多张图片? - How to upload multiple image on firebase using swift? 在应用程序上使用时,为每个“getKey()”重新组合 firebase 上的所有数据 - Regroupe all data on firebase for each "getKey()" when using them on app Firebase function 对于我的 React 应用程序不起作用 - Firebase function for my react app not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM