firebase / firebase-ios-sdk
firebase / firebase-ios-sdk
Warning: New versions of the Firebase Apple SDK will no longer be published to CocoaPods after October 2026. Existing CocoaPods versions will remain available and installations will remain functional. See the migration guide for more information. 警告: Firebase Apple SDK 的新版本将在 2026 年 10 月之后停止发布到 CocoaPods。现有的 CocoaPods 版本将继续可用,安装功能也将保持正常。更多信息请参阅迁移指南。
Tip: Preview Release: Firebase AI Logic’s Gemini Foundation Models framework adapter is now available in preview. Get started by visiting the documentation. 提示: 预览版发布:Firebase AI Logic 的 Gemini 基础模型框架适配器现已提供预览。请访问文档以开始使用。
Firebase Apple Open Source Development This repository contains the source code for all Apple platform Firebase libraries except FirebaseAnalytics. Firebase is an app development platform with libraries, services, and tools to help you build, grow, and monetize your app. Learn more about Firebase at the official Firebase website. Firebase Apple 开源开发 本仓库包含除 FirebaseAnalytics 外所有 Apple 平台 Firebase 库的源代码。Firebase 是一个应用开发平台,提供各种库、服务和工具,帮助您构建、发展并实现应用变现。欲了解更多关于 Firebase 的信息,请访问 Firebase 官方网站。
Supported Firebase Products The following products are open-source and included in this repository: Firebase AI Logic (FirebaseAI), App Check (FirebaseAppCheck), App Distribution (FirebaseAppDistribution), Authentication (FirebaseAuth), Cloud Firestore (FirebaseFirestore), Cloud Functions (FirebaseFunctions), Cloud Messaging (FirebaseMessaging), Crashlytics (FirebaseCrashlytics), In-App Messaging (FirebaseInAppMessaging), Performance Monitoring (FirebasePerformance), Realtime Database (FirebaseDatabase), Remote Config (FirebaseRemoteConfig), Storage (FirebaseStorage). 支持的 Firebase 产品 以下产品为开源产品并包含在本仓库中:Firebase AI Logic (FirebaseAI)、App Check (FirebaseAppCheck)、App Distribution (FirebaseAppDistribution)、Authentication (FirebaseAuth)、Cloud Firestore (FirebaseFirestore)、Cloud Functions (FirebaseFunctions)、Cloud Messaging (FirebaseMessaging)、Crashlytics (FirebaseCrashlytics)、In-App Messaging (FirebaseInAppMessaging)、Performance Monitoring (FirebasePerformance)、Realtime Database (FirebaseDatabase)、Remote Config (FirebaseRemoteConfig)、Storage (FirebaseStorage)。
Note: Firebase Analytics is not open-source, but its pre-compiled binaries are included when installing Firebase via Swift Package Manager or CocoaPods. 注意: Firebase Analytics 不开源,但在通过 Swift Package Manager 或 CocoaPods 安装 Firebase 时,会包含其预编译的二进制文件。
Installation See the subsections below for details about the different installation methods. Where available, it’s recommended to install libraries with a Swift suffix to get the best experience when writing your app in Swift. 安装 请参阅以下小节了解不同安装方法的详细信息。在条件允许的情况下,建议安装带有 Swift 后缀的库,以便在用 Swift 编写应用时获得最佳体验。
- Swift Package Manager
- CocoaPods
- Install from GitHub
- Experimental Carthage
- Framework or library
Swift Package Manager installation Find instructions for installing using Swift Package Manager in the Firebase get started documentation. Swift Package Manager 安装 请在 Firebase 入门文档中查找使用 Swift Package Manager 进行安装的说明。
CocoaPods installation Find instructions for installing with CocoaPods (pod install) in the Firebase installation options documentation. Note: To accommodate the read-only announcement from CocoaPods, Firebase will stop publishing new versions to CocoaPods in October 2026. Learn more. CocoaPods 安装 请在 Firebase 安装选项文档中查找使用 CocoaPods (pod install) 进行安装的说明。注意:为配合 CocoaPods 的只读公告,Firebase 将于 2026 年 10 月停止向 CocoaPods 发布新版本。了解更多。
Install from GitHub You can install from GitHub to access the Firebase repo at other branches, tags, or commits. 从 GitHub 安装 您可以从 GitHub 安装,以访问 Firebase 仓库的其他分支、标签或提交版本。
Background For instructions and options about overriding pod source locations, see the Podfile Syntax Reference. 背景 有关覆盖 pod 源位置的说明和选项,请参阅 Podfile 语法参考。
Access Firebase source snapshots All official releases are tagged in this repo and available via CocoaPods. To access a local source snapshot or unreleased branch, use Podfile directives. Here are some example directives which use FirebaseFirestore as the example library. 访问 Firebase 源码快照 所有正式版本均在本仓库中打标,并可通过 CocoaPods 获取。要访问本地源码快照或未发布的分支,请使用 Podfile 指令。以下是以 FirebaseFirestore 为例的指令示例。
To access FirebaseFirestore via a branch: 通过分支访问 FirebaseFirestore:
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'main'
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'main'
To access FirebaseFirestore via a checked-out version of the firebase-ios-sdk repo: 通过已检出的 firebase-ios-sdk 仓库版本访问 FirebaseFirestore:
pod 'FirebaseCore', :path => '/path/to/firebase-ios-sdk'
pod 'FirebaseFirestore', :path => '/path/to/firebase-ios-sdk'
Carthage (iOS only) Find instructions for the experimental Carthage distribution (iOS only) at Carthage.md within this repo. Carthage (仅限 iOS) 请在本仓库的 Carthage.md 中查找实验性 Carthage 分发版(仅限 iOS)的说明。
Use Firebase from a Framework or a library Find details about using Firebase from a Framework or a library at firebase_in_libraries.md within this repo. 从框架或库中使用 Firebase 请在本仓库的 firebase_in_libraries.md 中查找从框架或库中使用 Firebase 的详细信息。
Building with Firebase on Apple platforms Firebase provides official beta support for macOS, Catalyst, and tvOS. visionOS and watchOS are community supported. Thanks to community contributions for many of the multi-platform PRs. At this time, most Firebase products are available across Apple platforms. There are still a few gaps, especially on visionOS and watchOS. For details about the current support matrix, see this chart in the Firebase documentation. 在 Apple 平台上构建 Firebase Firebase 为 macOS、Catalyst 和 tvOS 提供官方 Beta 支持。visionOS 和 watchOS 由社区提供支持。感谢社区为许多多平台 PR 做出的贡献。目前,大多数 Firebase 产品都可在 Apple 平台上使用。仍存在一些空白,特别是在 visionOS 和 watchOS 上。有关当前支持矩阵的详细信息,请参阅 Firebase 文档中的此图表。
visionOS
Where supported, visionOS works as expected with the exception of Firestore via Swift Package Manager where it is required to use the source distribution. To enable the Firestore source distribution, quit Xcode and open the desired project from the command line with the FIREBASE_SOURCE_FIRESTORE environment variable: open --env FIREBASE_SOURCE_FIRESTORE /path/to/project.xcodeproj. To go back to using the binary distribution of Firestore, quit Xcode and open Xcode like normal, without the environment variable.
visionOS
在支持的情况下,visionOS 的工作符合预期,但通过 Swift Package Manager 使用 Firestore 时除外,该情况需要使用源码分发版。要启用 Firestore 源码分发,请退出 Xcode 并通过命令行使用 FIREBASE_SOURCE_FIRESTORE 环境变量打开目标项目:open --env FIREBASE_SOURCE_FIRESTORE /path/to/project.xcodeproj。要恢复使用 Firestore 的二进制分发版,请退出 Xcode 并像往常一样打开 Xcode,无需设置环境变量。
watchOS Thanks to contributions from the community, many of Firebase SDKs now compile, run unit tests, and work on watchOS. See the Independent Watch App Sample. Keep in mind that watchOS is not officially supported by Firebase. While we can catch basic unit test issues with GitHub Actions, there may be some changes where the SDK no longer works as expected on watchOS. If you encounter this, please file an issue. During app setup in the console, you may get to a step that mentions something like “Checking if the app has communicated with our servers”. This relies on FirebaseAnalytics and will not work on watchOS. It’s safe to ignore the message and continue, the rest of the SDKs will work as expected. watchOS 感谢社区的贡献,许多 Firebase SDK 现在可以在 watchOS 上编译、运行单元测试并正常工作。请参阅 Independent Watch App Sample。请记住,Firebase 并不正式支持 watchOS。虽然我们可以通过 GitHub Actions 捕获基本的单元测试问题,但可能会出现 SDK 在 watchOS 上无法按预期工作的情况。如果您遇到这种情况,请提交 Issue。在控制台进行应用设置时,您可能会遇到类似“正在检查应用是否已与我们的服务器通信”的步骤。这依赖于 FirebaseAnalytics,在 watchOS 上无法工作。您可以安全地忽略此消息并继续,其余 SDK 将按预期工作。
Additional Crashlytics notes for watchOS Using Crashlytics with watchOS has limited support. Due to watchOS restrictions, mach exceptions and signal crashes are not recorded. (Crashes in SwiftUI are generated as mach exceptions, so will not be recorded). 关于 watchOS 的 Crashlytics 补充说明 在 watchOS 上使用 Crashlytics 的支持有限。由于 watchOS 的限制,mach 异常和信号崩溃不会被记录。(SwiftUI 中的崩溃生成为 mach 异常,因此不会被记录)。
Combine Thanks to contributions from the community, FirebaseCombineSwift contains support for Apple’s Combine framework. This module is currently under development and not yet supported for use in production environments. For more details, see the docs within this repo. Combine 感谢社区的贡献,FirebaseCombineSwift 现已包含对 Apple Combine 框架的支持。该模块目前处于开发阶段,尚不支持在生产环境中使用。更多详细信息,请参阅本仓库中的文档。
Roadmap See Roadmap for more about the Firebase Apple SDK Open Source plans and directions. 路线图 请参阅路线图以了解更多关于 Firebase Apple SDK 开源计划和方向的信息。
Contributing For information on how to contribute, set up the development environment, build, or test the SDK, see the Contributing Guide. 贡献 有关如何贡献、设置开发环境、构建或测试 SDK 的信息,请参阅贡献指南。
License The contents of this repository are licensed under the Apache License, version 2.0. Your use of Firebase is govern… 许可 本仓库的内容采用 Apache License 2.0 版本许可。您对 Firebase 的使用受…