1 |
efrain |
1 |
[](https://cocoapods.org/pods/Firebase)
|
|
|
2 |
[](https://cocoapods.org/pods/Firebase)
|
|
|
3 |
[](https://cocoapods.org/pods/Firebase)
|
|
|
4 |
|
|
|
5 |
[![Actions Status][gh-abtesting-badge]][gh-actions]
|
|
|
6 |
[![Actions Status][gh-appcheck-badge]][gh-actions]
|
|
|
7 |
[![Actions Status][gh-appdistribution-badge]][gh-actions]
|
|
|
8 |
[![Actions Status][gh-auth-badge]][gh-actions]
|
|
|
9 |
[![Actions Status][gh-cocoapods-integration-badge]][gh-actions]
|
|
|
10 |
[![Actions Status][gh-core-badge]][gh-actions]
|
|
|
11 |
[![Actions Status][gh-core-diagnostics-badge]][gh-actions]
|
|
|
12 |
[![Actions Status][gh-crashlytics-badge]][gh-actions]
|
|
|
13 |
[![Actions Status][gh-database-badge]][gh-actions]
|
|
|
14 |
[![Actions Status][gh-datatransport-badge]][gh-actions]
|
|
|
15 |
[![Actions Status][gh-dynamiclinks-badge]][gh-actions]
|
|
|
16 |
[![Actions Status][gh-firebasepod-badge]][gh-actions]
|
|
|
17 |
[![Actions Status][gh-firestore-badge]][gh-actions]
|
|
|
18 |
[![Actions Status][gh-functions-badge]][gh-actions]
|
|
|
19 |
[![Actions Status][gh-google-utilities-badge]][gh-actions]
|
|
|
20 |
[![Actions Status][gh-google-utilities-components-badge]][gh-actions]
|
|
|
21 |
[![Actions Status][gh-inappmessaging-badge]][gh-actions]
|
|
|
22 |
[![Actions Status][gh-interop-badge]][gh-actions]
|
|
|
23 |
[![Actions Status][gh-messaging-badge]][gh-actions]
|
|
|
24 |
[![Actions Status][gh-mlmodeldownloader-badge]][gh-actions]
|
|
|
25 |
[![Actions Status][gh-performance-badge]][gh-actions]
|
|
|
26 |
[![Actions Status][gh-remoteconfig-badge]][gh-actions]
|
|
|
27 |
[![Actions Status][gh-storage-badge]][gh-actions]
|
|
|
28 |
[![Actions Status][gh-symbolcollision-badge]][gh-actions]
|
|
|
29 |
[![Actions Status][gh-zip-badge]][gh-actions]
|
|
|
30 |
|
|
|
31 |
# Firebase Apple Open Source Development
|
|
|
32 |
|
|
|
33 |
This repository contains all Apple platform Firebase SDK source except FirebaseAnalytics
|
|
|
34 |
and FirebaseML.
|
|
|
35 |
|
|
|
36 |
Firebase is an app development platform with tools to help you build, grow and
|
|
|
37 |
monetize your app. More information about Firebase can be found on the
|
|
|
38 |
[official Firebase website](https://firebase.google.com).
|
|
|
39 |
|
|
|
40 |
## Installation
|
|
|
41 |
|
|
|
42 |
See the subsections below for details about the different installation methods.
|
|
|
43 |
1. [Standard pod install](#standard-pod-install)
|
|
|
44 |
1. [Swift Package Manager](#swift-package-manager)
|
|
|
45 |
1. [Installing from the GitHub repo](#installing-from-github)
|
|
|
46 |
1. [Experimental Carthage](#carthage-ios-only)
|
|
|
47 |
|
|
|
48 |
### Standard pod install
|
|
|
49 |
|
|
|
50 |
Go to
|
|
|
51 |
[https://firebase.google.com/docs/ios/setup](https://firebase.google.com/docs/ios/setup).
|
|
|
52 |
|
|
|
53 |
### Swift Package Manager
|
|
|
54 |
|
|
|
55 |
Instructions for [Swift Package Manager](https://swift.org/package-manager/) support can be
|
|
|
56 |
found at [SwiftPackageManager](SwiftPackageManager.md) Markdown file.
|
|
|
57 |
|
|
|
58 |
### Installing from GitHub
|
|
|
59 |
|
|
|
60 |
These instructions can be used to access the Firebase repo at other branches,
|
|
|
61 |
tags, or commits.
|
|
|
62 |
|
|
|
63 |
#### Background
|
|
|
64 |
|
|
|
65 |
See
|
|
|
66 |
[the Podfile Syntax Reference](https://guides.cocoapods.org/syntax/podfile.html#pod)
|
|
|
67 |
for instructions and options about overriding pod source locations.
|
|
|
68 |
|
|
|
69 |
#### Accessing Firebase Source Snapshots
|
|
|
70 |
|
|
|
71 |
All of the official releases are tagged in this repo and available via CocoaPods. To access a local
|
|
|
72 |
source snapshot or unreleased branch, use Podfile directives like the following:
|
|
|
73 |
|
|
|
74 |
To access FirebaseFirestore via a branch:
|
|
|
75 |
```ruby
|
|
|
76 |
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
|
|
|
77 |
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
|
|
|
78 |
```
|
|
|
79 |
|
|
|
80 |
To access FirebaseMessaging via a checked out version of the firebase-ios-sdk repo do:
|
|
|
81 |
|
|
|
82 |
```ruby
|
|
|
83 |
pod 'FirebaseCore', :path => '/path/to/firebase-ios-sdk'
|
|
|
84 |
pod 'FirebaseMessaging', :path => '/path/to/firebase-ios-sdk'
|
|
|
85 |
```
|
|
|
86 |
|
|
|
87 |
### Carthage (iOS only)
|
|
|
88 |
|
|
|
89 |
Instructions for the experimental Carthage distribution are at
|
|
|
90 |
[Carthage](Carthage.md).
|
|
|
91 |
|
|
|
92 |
### Using Firebase from a Framework or a library
|
|
|
93 |
|
|
|
94 |
[Using Firebase from a Framework or a library](docs/firebase_in_libraries.md)
|
|
|
95 |
|
|
|
96 |
## Development
|
|
|
97 |
|
|
|
98 |
To develop Firebase software in this repository, ensure that you have at least
|
|
|
99 |
the following software:
|
|
|
100 |
|
|
|
101 |
* Xcode 12.2 (or later)
|
|
|
102 |
|
|
|
103 |
CocoaPods is still the canonical way to develop, but much of the repo now supports
|
|
|
104 |
development with Swift Package Manager.
|
|
|
105 |
|
|
|
106 |
### CocoaPods
|
|
|
107 |
|
|
|
108 |
Install
|
|
|
109 |
* CocoaPods 1.10.0 (or later)
|
|
|
110 |
* [CocoaPods generate](https://github.com/square/cocoapods-generate)
|
|
|
111 |
|
|
|
112 |
For the pod that you want to develop:
|
|
|
113 |
|
|
|
114 |
```ruby
|
|
|
115 |
pod gen Firebase{name here}.podspec --local-sources=./ --auto-open --platforms=ios
|
|
|
116 |
```
|
|
|
117 |
|
|
|
118 |
Note: If the CocoaPods cache is out of date, you may need to run
|
|
|
119 |
`pod repo update` before the `pod gen` command.
|
|
|
120 |
|
|
|
121 |
Note: Set the `--platforms` option to `macos` or `tvos` to develop/test for
|
|
|
122 |
those platforms. Since 10.2, Xcode does not properly handle multi-platform
|
|
|
123 |
CocoaPods workspaces.
|
|
|
124 |
|
|
|
125 |
Firestore has a self contained Xcode project. See
|
|
|
126 |
[Firestore/README](Firestore/README.md) Markdown file.
|
|
|
127 |
|
|
|
128 |
#### Development for Catalyst
|
|
|
129 |
* `pod gen {name here}.podspec --local-sources=./ --auto-open --platforms=ios`
|
|
|
130 |
* Check the Mac box in the App-iOS Build Settings
|
|
|
131 |
* Sign the App in the Settings Signing & Capabilities tab
|
|
|
132 |
* Click Pods in the Project Manager
|
|
|
133 |
* Add Signing to the iOS host app and unit test targets
|
|
|
134 |
* Select the Unit-unit scheme
|
|
|
135 |
* Run it to build and test
|
|
|
136 |
|
|
|
137 |
Alternatively disable signing in each target:
|
|
|
138 |
* Go to Build Settings tab
|
|
|
139 |
* Click `+`
|
|
|
140 |
* Select `Add User-Defined Setting`
|
|
|
141 |
* Add `CODE_SIGNING_REQUIRED` setting with a value of `NO`
|
|
|
142 |
|
|
|
143 |
### Swift Package Manager
|
|
|
144 |
* To enable test schemes: `./scripts/setup_spm_tests.sh`
|
|
|
145 |
* `open Package.swift` or double click `Package.swift` in Finder.
|
|
|
146 |
* Xcode will open the project
|
|
|
147 |
* Choose a scheme for a library to build or test suite to run
|
|
|
148 |
* Choose a target platform by selecting the run destination along with the scheme
|
|
|
149 |
|
|
|
150 |
### Adding a New Firebase Pod
|
|
|
151 |
|
|
|
152 |
See [AddNewPod](AddNewPod.md) Markdown file.
|
|
|
153 |
|
|
|
154 |
### Managing Headers and Imports
|
|
|
155 |
|
|
|
156 |
See [HeadersImports](HeadersImports.md) Markdown file.
|
|
|
157 |
|
|
|
158 |
### Code Formatting
|
|
|
159 |
|
|
|
160 |
To ensure that the code is formatted consistently, run the script
|
|
|
161 |
[./scripts/check.sh](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/check.sh)
|
|
|
162 |
before creating a PR.
|
|
|
163 |
|
|
|
164 |
GitHub Actions will verify that any code changes are done in a style compliant
|
|
|
165 |
way. Install `clang-format` and `mint`:
|
|
|
166 |
|
|
|
167 |
```console
|
|
|
168 |
brew install clang-format@14
|
|
|
169 |
brew install mint
|
|
|
170 |
```
|
|
|
171 |
|
|
|
172 |
### Running Unit Tests
|
|
|
173 |
|
|
|
174 |
Select a scheme and press Command-u to build a component and run its unit tests.
|
|
|
175 |
|
|
|
176 |
### Running Sample Apps
|
|
|
177 |
In order to run the sample apps and integration tests, you'll need a valid
|
|
|
178 |
`GoogleService-Info.plist` file. The Firebase Xcode project contains dummy plist
|
|
|
179 |
files without real values, but can be replaced with real plist files. To get your own
|
|
|
180 |
`GoogleService-Info.plist` files:
|
|
|
181 |
|
|
|
182 |
1. Go to the [Firebase Console](https://console.firebase.google.com/)
|
|
|
183 |
2. Create a new Firebase project, if you don't already have one
|
|
|
184 |
3. For each sample app you want to test, create a new Firebase app with the sample app's bundle
|
|
|
185 |
identifier (e.g. `com.google.Database-Example`)
|
|
|
186 |
4. Download the resulting `GoogleService-Info.plist` and add it to the Xcode project.
|
|
|
187 |
|
|
|
188 |
### Coverage Report Generation
|
|
|
189 |
|
|
|
190 |
See [scripts/code_coverage_report/README](scripts/code_coverage_report/README.md) Markdown file.
|
|
|
191 |
|
|
|
192 |
## Specific Component Instructions
|
|
|
193 |
See the sections below for any special instructions for those components.
|
|
|
194 |
|
|
|
195 |
### Firebase Auth
|
|
|
196 |
|
|
|
197 |
If you're doing specific Firebase Auth development, see
|
|
|
198 |
[the Auth Sample README](FirebaseAuth/Tests/Sample/README.md) for instructions about
|
|
|
199 |
building and running the FirebaseAuth pod along with various samples and tests.
|
|
|
200 |
|
|
|
201 |
### Firebase Database
|
|
|
202 |
|
|
|
203 |
The Firebase Database Integration tests can be run against a locally running Database Emulator
|
|
|
204 |
or against a production instance.
|
|
|
205 |
|
|
|
206 |
To run against a local emulator instance, invoke `./scripts/run_database_emulator.sh start` before
|
|
|
207 |
running the integration test.
|
|
|
208 |
|
|
|
209 |
To run against a production instance, provide a valid GoogleServices-Info.plist and copy it to
|
|
|
210 |
`FirebaseDatabase/Tests/Resources/GoogleService-Info.plist`. Your Security Rule must be set to
|
|
|
211 |
[public](https://firebase.google.com/docs/database/security/quickstart) while your tests are
|
|
|
212 |
running.
|
|
|
213 |
|
|
|
214 |
### Firebase Performance Monitoring
|
|
|
215 |
If you're doing specific Firebase Performance Monitoring development, see
|
|
|
216 |
[the Performance README](FirebasePerformance/README.md) for instructions about building the SDK
|
|
|
217 |
and [the Performance TestApp README](FirebasePerformance/Tests/TestApp/README.md) for instructions about
|
|
|
218 |
integrating Performance with the dev test App.
|
|
|
219 |
|
|
|
220 |
### Firebase Storage
|
|
|
221 |
|
|
|
222 |
To run the Storage Integration tests, follow the instructions in
|
|
|
223 |
[FIRStorageIntegrationTests.m](FirebaseStorage/Tests/Integration/FIRStorageIntegrationTests.m).
|
|
|
224 |
|
|
|
225 |
#### Push Notifications
|
|
|
226 |
|
|
|
227 |
Push notifications can only be delivered to specially provisioned App IDs in the developer portal.
|
|
|
228 |
In order to actually test receiving push notifications, you will need to:
|
|
|
229 |
|
|
|
230 |
1. Change the bundle identifier of the sample app to something you own in your Apple Developer
|
|
|
231 |
account, and enable that App ID for push notifications.
|
|
|
232 |
2. You'll also need to
|
|
|
233 |
[upload your APNs Provider Authentication Key or certificate to the
|
|
|
234 |
Firebase Console](https://firebase.google.com/docs/cloud-messaging/ios/certs)
|
|
|
235 |
at **Project Settings > Cloud Messaging > [Your Firebase App]**.
|
|
|
236 |
3. Ensure your iOS device is added to your Apple Developer portal as a test device.
|
|
|
237 |
|
|
|
238 |
#### iOS Simulator
|
|
|
239 |
|
|
|
240 |
The iOS Simulator cannot register for remote notifications, and will not receive push notifications.
|
|
|
241 |
In order to receive push notifications, you'll have to follow the steps above and run the app on a
|
|
|
242 |
physical device.
|
|
|
243 |
|
|
|
244 |
## Building with Firebase on Apple platforms
|
|
|
245 |
|
|
|
246 |
Firebase 8.9.0 introduces official beta support for macOS, Catalyst, and tvOS. watchOS continues
|
|
|
247 |
to be community supported. Thanks to community contributions for many of the multi-platform PRs.
|
|
|
248 |
|
|
|
249 |
At this time, most of Firebase's products are available across Apple platforms. There are still
|
|
|
250 |
a few gaps, especially on watchOS. For details about the current support matrix, see
|
|
|
251 |
[this chart](https://firebase.google.com/docs/ios/learn-more#firebase_library_support_by_platform)
|
|
|
252 |
in Firebase's documentation.
|
|
|
253 |
|
|
|
254 |
### watchOS
|
|
|
255 |
Thanks to contributions from the community, many of Firebase SDKs now compile, run unit tests, and
|
|
|
256 |
work on watchOS. See the [Independent Watch App Sample](Example/watchOSSample).
|
|
|
257 |
|
|
|
258 |
Keep in mind that watchOS is not officially supported by Firebase. While we can catch basic unit
|
|
|
259 |
test issues with GitHub Actions, there may be some changes where the SDK no longer works as expected
|
|
|
260 |
on watchOS. If you encounter this, please
|
|
|
261 |
[file an issue](https://github.com/firebase/firebase-ios-sdk/issues).
|
|
|
262 |
|
|
|
263 |
During app setup in the console, you may get to a step that mentions something like "Checking if the
|
|
|
264 |
app has communicated with our servers". This relies on Analytics and will not work on watchOS.
|
|
|
265 |
**It's safe to ignore the message and continue**, the rest of the SDKs will work as expected.
|
|
|
266 |
|
|
|
267 |
#### Additional Crashlytics Notes
|
|
|
268 |
* watchOS has limited support. Due to watchOS restrictions, mach exceptions and signal crashes are
|
|
|
269 |
not recorded. (Crashes in SwiftUI are generated as mach exceptions, so will not be recorded)
|
|
|
270 |
|
|
|
271 |
## Combine
|
|
|
272 |
Thanks to contributions from the community, _FirebaseCombineSwift_ contains support for Apple's Combine
|
|
|
273 |
framework. This module is currently under development, and not yet supported for use in production
|
|
|
274 |
environments. Fore more details, please refer to the [docs](FirebaseCombineSwift/README.md).
|
|
|
275 |
|
|
|
276 |
## Roadmap
|
|
|
277 |
|
|
|
278 |
See [Roadmap](ROADMAP.md) for more about the Firebase Apple SDK Open Source
|
|
|
279 |
plans and directions.
|
|
|
280 |
|
|
|
281 |
## Contributing
|
|
|
282 |
|
|
|
283 |
See [Contributing](CONTRIBUTING.md) for more information on contributing to the Firebase
|
|
|
284 |
Apple SDK.
|
|
|
285 |
|
|
|
286 |
## License
|
|
|
287 |
|
|
|
288 |
The contents of this repository are licensed under the
|
|
|
289 |
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
|
|
290 |
|
|
|
291 |
Your use of Firebase is governed by the
|
|
|
292 |
[Terms of Service for Firebase Services](https://firebase.google.com/terms/).
|
|
|
293 |
|
|
|
294 |
[gh-actions]: https://github.com/firebase/firebase-ios-sdk/actions
|
|
|
295 |
[gh-abtesting-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/abtesting/badge.svg
|
|
|
296 |
[gh-appcheck-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/app_check/badge.svg
|
|
|
297 |
[gh-appdistribution-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/appdistribution/badge.svg
|
|
|
298 |
[gh-auth-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/auth/badge.svg
|
|
|
299 |
[gh-cocoapods-integration-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/cocoapods-integration/badge.svg
|
|
|
300 |
[gh-core-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/core/badge.svg
|
|
|
301 |
[gh-core-diagnostics-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/core-diagnostics/badge.svg
|
|
|
302 |
[gh-crashlytics-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/crashlytics/badge.svg
|
|
|
303 |
[gh-database-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/database/badge.svg
|
|
|
304 |
[gh-datatransport-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/datatransport/badge.svg
|
|
|
305 |
[gh-dynamiclinks-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/dynamiclinks/badge.svg
|
|
|
306 |
[gh-firebasepod-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/firebasepod/badge.svg
|
|
|
307 |
[gh-firestore-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/firestore/badge.svg
|
|
|
308 |
[gh-functions-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/functions/badge.svg
|
|
|
309 |
[gh-google-utilities-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/google-utilities/badge.svg
|
|
|
310 |
[gh-google-utilities-components-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/google-utilities-components/badge.svg
|
|
|
311 |
[gh-inappmessaging-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/inappmessaging/badge.svg
|
|
|
312 |
[gh-interop-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/interop/badge.svg
|
|
|
313 |
[gh-messaging-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/messaging/badge.svg
|
|
|
314 |
[gh-mlmodeldownloader-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/mlmodeldownloader/badge.svg
|
|
|
315 |
[gh-performance-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/performance/badge.svg
|
|
|
316 |
[gh-remoteconfig-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/remoteconfig/badge.svg
|
|
|
317 |
[gh-storage-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/storage/badge.svg
|
|
|
318 |
[gh-symbolcollision-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/symbolcollision/badge.svg
|
|
|
319 |
[gh-zip-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/zip/badge.svg
|