firebase ios_适用于Android和iOS的Firebase实时数据库登录教程

2022-04-08 00:00:00 项目 应用程序 您可以 您的 实时

firebase ios

Mobile apps need a backend. They store settings & data, high scores, check licenses and generate statistics. All these use cases have one thing in common: they use a central database.

移动应用程序需要后端。 他们存储设置和数据,高分,检查许可证并生成统计信息。 所有这些用例都有一个共同点:它们使用中央数据库。

Coding a full-blown backend takes a lot of time. Think about end-to-end security, communication interfaces and database structure. When you then get to details like concurrent access, it gets tricky.

编码一个完整的后端需要很多时间。 考虑端到端的安全性,通信接口和数据库结构。 然后,当您获得诸如并发访问之类的详细信息时,就会很棘手。

Luckily, Google Firebase takes care of all these issues for you. It’s a ready-to-use cloud-hosted database with full authentication support. In contrast to a traditional SQL database, Google Firebase stores JSON data sets (-> NoSQL). This gives you more flexibility in your data structure.

幸运的是, Google Firebase会为您解决所有这些问题。 这是一个具有完整身份验证支持的即用型云托管数据库。 与传统SQL数据库相比,Google Firebase存储JSON数据集(-> NoSQL )。 这为您的数据结构提供了更大的灵活性。

On top of that, you can subscribe to real-time data changes. You’ll get notified about updates made to the data, for example by other users. The service does offer a simple REST API. But the most efficient communication is a publish & subscribe model via websockets.

重要的是,您可以订阅实时数据更改。 您将收到有关数据更新的通知,例如其他用户。 该服务确实提供了简单的REST API 。 但是有效的通信是通过websockets的发布和订阅模型。

That sounds complicated? Google offers a separate SDK for each platform. With Felgo & Qt, you don’t need to worry about platform differences. Felgo includes a cross-platform Google Firebase Realtime Database plugin. The same QML / JavaScript-based API works for both Android & iOS.

听起来复杂吗? Google为每个平台提供了单独的SDK。 使用Felgo&Qt,您无需担心平台差异。 Felgo包含一个跨平台的Google Firebase实时数据库插件 。 相同的基于QML / JavaScript的API适用于Android和iOS。

If you need help with that, consult or outsource your app development with Felgo.

如果您需要帮助,请向Felgo咨询或外包您的应用程序开发 。

入门 (Getting Started)

In this Firebase tutorial, you’ll complete the full journey from start to end. You start with a project template of Qt Creator. Next, you’ll set up the Firebase service in the cloud. Another important task is user authentication. Most impressive: live database updates from & to your cross-platform app.

在此Firebase教程中,您将完成从头到尾的整个旅程。 您将从Qt Creator的项目模板开始。 接下来,您将在云中设置Firebase服务。 另一个重要任务是用户身份验证。 令人印象深刻的是:从&跨平台应用实时更新数据库。

The scenario is a simple shopping list. It’s a generic app that includes everything most apps need. Authentication, plus adding, updating and deleting items. Once you understand the concepts, it’s easy to adapt them to your own scenario.

该方案是一个简单的购物清单。 这是一个通用应用程序,其中包含大多数应用程序需要的所有内容。 身份验证,以及添加,更新和删除项目。 一旦理解了这些概念,就很容易将它们适应您自己的方案。

If you’re impatient, skip right to the final project source code on GitHub.

如果您不耐烦,请直接跳至GitHub上的终项目源代码。

在YouTube上观看本教程 (Watch this Tutorial on YouTube)

You can also watch the video version of this tutorial on YouTube. It is very much in-depth and covers every single step of the process.

您也可以在YouTube上观看本教程的视频版本。 它非常深入,涵盖了过程的每个步骤。

您的Cloud Backend的主从UI (Master-Detail UI for your Cloud Backend)

Curious to dive right into the cloud database? Well, you will need your “app package name” for Android and the “iOS bundle ID” when setting up Firebase.

是否想直接进入云数据库? 好了,设置Firebase时,您将需要Android的“应用程序包名称”和“ iOS软件包ID”。

Thus, start with the app and make your life easier. Open Qt Creator and create a new project. Use the “Felgo Apps” > “Master-Detail Application”. This gives you great boilerplate code for any list-type app.

因此,从该应用程序开始,使您的生活更轻松。 打开Qt Creator并创建一个新项目。 使用“ Felgo应用程序”>“主从应用程序”。 这为您提供了任何列表类型应用程序的出色样板代码。

相关文章