You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
12 KiB

  1. [![Version](https://img.shields.io/cocoapods/v/Firebase.svg?style=flat)](https://cocoapods.org/pods/Firebase)
  2. [![License](https://img.shields.io/cocoapods/l/Firebase.svg?style=flat)](https://cocoapods.org/pods/Firebase)
  3. [![Platform](https://img.shields.io/cocoapods/p/Firebase.svg?style=flat)](https://cocoapods.org/pods/Firebase)
  4. [![Actions Status][gh-auth-badge]][gh-actions]
  5. [![Actions Status][gh-core-badge]][gh-actions]
  6. [![Actions Status][gh-datatransport-badge]][gh-actions]
  7. [![Actions Status][gh-dynamiclinks-badge]][gh-actions]
  8. [![Actions Status][gh-firebasepod-badge]][gh-actions]
  9. [![Actions Status][gh-firestore-badge]][gh-actions]
  10. [![Actions Status][gh-interop-badge]][gh-actions]
  11. [![Actions Status][gh-messaging-badge]][gh-actions]
  12. [![Actions Status][gh-storage-badge]][gh-actions]
  13. [![Actions Status][gh-symbolcollision-badge]][gh-actions]
  14. [![Actions Status][gh-zip-badge]][gh-actions]
  15. [![Travis](https://travis-ci.org/firebase/firebase-ios-sdk.svg?branch=master)](https://travis-ci.org/firebase/firebase-ios-sdk)
  16. # Firebase Apple Open Source Development
  17. This repository contains all Apple platform Firebase SDK source except FirebaseAnalytics,
  18. FirebasePerformance, and FirebaseML.
  19. The repository also includes GoogleUtilities source. The
  20. [GoogleUtilities](GoogleUtilities/README.md) pod is
  21. a set of utilities used by Firebase and other Google products.
  22. Firebase is an app development platform with tools to help you build, grow and
  23. monetize your app. More information about Firebase can be found at
  24. [https://firebase.google.com](https://firebase.google.com).
  25. ## Installation
  26. See the three subsections for details about three different installation methods.
  27. 1. [Standard pod install](README.md#standard-pod-install)
  28. 1. [Installing from the GitHub repo](README.md#installing-from-github)
  29. 1. [Experimental Carthage](README.md#carthage-ios-only)
  30. ### Standard pod install
  31. Go to
  32. [https://firebase.google.com/docs/ios/setup](https://firebase.google.com/docs/ios/setup).
  33. ### Installing from GitHub
  34. For releases starting with 5.0.0, the source for each release is also deployed
  35. to CocoaPods master and available via standard
  36. [CocoaPods Podfile syntax](https://guides.cocoapods.org/syntax/podfile.html#pod).
  37. These instructions can be used to access the Firebase repo at other branches,
  38. tags, or commits.
  39. #### Background
  40. See
  41. [the Podfile Syntax Reference](https://guides.cocoapods.org/syntax/podfile.html#pod)
  42. for instructions and options about overriding pod source locations.
  43. #### Accessing Firebase Source Snapshots
  44. All of the official releases are tagged in this repo and available via CocoaPods. To access a local
  45. source snapshot or unreleased branch, use Podfile directives like the following:
  46. To access FirebaseFirestore via a branch:
  47. ```
  48. pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
  49. pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
  50. ```
  51. To access FirebaseMessaging via a checked out version of the firebase-ios-sdk repo do:
  52. ```
  53. pod 'FirebaseCore', :path => '/path/to/firebase-ios-sdk'
  54. pod 'FirebaseMessaging', :path => '/path/to/firebase-ios-sdk'
  55. ```
  56. ### Carthage (iOS only)
  57. Instructions for the experimental Carthage distribution are at
  58. [Carthage](Carthage.md).
  59. ### Rome
  60. Instructions for installing binary frameworks via
  61. [Rome](https://github.com/CocoaPods/Rome) are at [Rome](Rome.md).
  62. ### Using Firebase from a Framework or a library
  63. [Using Firebase from a Framework or a library](docs/firebase_in_libraries.md)
  64. ## Development
  65. To develop Firebase software in this repository, ensure that you have at least
  66. the following software:
  67. * Xcode 10.1 (or later)
  68. * CocoaPods 1.7.2 (or later)
  69. * [CocoaPods generate](https://github.com/square/cocoapods-generate)
  70. For the pod that you want to develop:
  71. `pod gen Firebase{name here}.podspec --local-sources=./ --auto-open --platforms=ios`
  72. Note: If the CocoaPods cache is out of date, you may need to run
  73. `pod repo update` before the `pod gen` command.
  74. Note: Set the `--platforms` option to `macos` or `tvos` to develop/test for
  75. those platforms. Since 10.2, Xcode does not properly handle multi-platform
  76. CocoaPods workspaces.
  77. Firestore has a self contained Xcode project. See
  78. [Firestore/README.md](Firestore/README.md).
  79. ### Development for Catalyst
  80. * `pod gen {name here}.podspec --local-sources=./ --auto-open --platforms=ios`
  81. * Check the Mac box in the App-iOS Build Settings
  82. * Sign the App in the Settings Signing & Capabilities tab
  83. * Click Pods in the Project Manager
  84. * Add Signing to the iOS host app and unit test targets
  85. * Select the Unit-unit scheme
  86. * Run it to build and test
  87. ### Adding a New Firebase Pod
  88. See [AddNewPod.md](AddNewPod.md).
  89. ### Code Formatting
  90. To ensure that the code is formatted consistently, run the script
  91. [./scripts/style.sh](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/style.sh)
  92. before creating a PR.
  93. Travis will verify that any code changes are done in a style compliant way. Install
  94. `clang-format` and `swiftformat`.
  95. These commands will get the right versions:
  96. ```
  97. brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/c6f1cbd/Formula/clang-format.rb
  98. brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/c13eda8/Formula/swiftformat.rb
  99. ```
  100. Note: if you already have a newer version of these installed you may need to
  101. `brew switch` to this version.
  102. To update this section, find the versions of clang-format and swiftformat.rb to
  103. match the versions in the CI failure logs
  104. [here](https://github.com/Homebrew/homebrew-core/tree/master/Formula).
  105. ### Running Unit Tests
  106. Select a scheme and press Command-u to build a component and run its unit tests.
  107. #### Viewing Code Coverage (Deprecated)
  108. First, make sure that [xcov](https://github.com/nakiostudio/xcov) is installed with `gem install xcov`.
  109. After running the `AllUnitTests_iOS` scheme in Xcode, execute
  110. `xcov --workspace Firebase.xcworkspace --scheme AllUnitTests_iOS --output_directory xcov_output`
  111. at Example/ in the terminal. This will aggregate the coverage, and you can run `open xcov_output/index.html` to see the results.
  112. ### Running Sample Apps
  113. In order to run the sample apps and integration tests, you'll need valid
  114. `GoogleService-Info.plist` files for those samples. The Firebase Xcode project contains dummy plist
  115. files without real values, but can be replaced with real plist files. To get your own
  116. `GoogleService-Info.plist` files:
  117. 1. Go to the [Firebase Console](https://console.firebase.google.com/)
  118. 2. Create a new Firebase project, if you don't already have one
  119. 3. For each sample app you want to test, create a new Firebase app with the sample app's bundle
  120. identifier (e.g. `com.google.Database-Example`)
  121. 4. Download the resulting `GoogleService-Info.plist` and replace the appropriate dummy plist file
  122. (e.g. in [Example/Database/App/](Example/Database/App/));
  123. Some sample apps like Firebase Messaging ([Example/Messaging/App](Example/Messaging/App)) require
  124. special Apple capabilities, and you will have to change the sample app to use a unique bundle
  125. identifier that you can control in your own Apple Developer account.
  126. ## Specific Component Instructions
  127. See the sections below for any special instructions for those components.
  128. ### Firebase Auth
  129. If you're doing specific Firebase Auth development, see
  130. [the Auth Sample README](FirebaseAuth/Tests/Sample/README.md) for instructions about
  131. building and running the FirebaseAuth pod along with various samples and tests.
  132. ### Firebase Database
  133. To run the Database Integration tests, make your database authentication rules
  134. [public](https://firebase.google.com/docs/database/security/quickstart).
  135. ### Firebase Storage
  136. To run the Storage Integration tests, follow the instructions in
  137. [FIRStorageIntegrationTests.m](FirebaseStorage/Tests/Integration/FIRStorageIntegrationTests.m).
  138. #### Push Notifications
  139. Push notifications can only be delivered to specially provisioned App IDs in the developer portal.
  140. In order to actually test receiving push notifications, you will need to:
  141. 1. Change the bundle identifier of the sample app to something you own in your Apple Developer
  142. account, and enable that App ID for push notifications.
  143. 2. You'll also need to
  144. [upload your APNs Provider Authentication Key or certificate to the Firebase Console](https://firebase.google.com/docs/cloud-messaging/ios/certs)
  145. at **Project Settings > Cloud Messaging > [Your Firebase App]**.
  146. 3. Ensure your iOS device is added to your Apple Developer portal as a test device.
  147. #### iOS Simulator
  148. The iOS Simulator cannot register for remote notifications, and will not receive push notifications.
  149. In order to receive push notifications, you'll have to follow the steps above and run the app on a
  150. physical device.
  151. ## Community Supported Efforts
  152. We've seen an amazing amount of interest and contributions to improve the Firebase SDKs, and we are
  153. very grateful! We'd like to empower as many developers as we can to be able to use Firebase and
  154. participate in the Firebase community.
  155. ### tvOS, macOS, watchOS and Catalyst
  156. Thanks to contributions from the community, many of Firebase SDKs now compile, run unit tests, and work on
  157. tvOS, macOS, watchOS and Catalyst.
  158. For tvOS, checkout the [Sample](Example/tvOSSample).
  159. For watchOS, currently only Messaging and Storage (and their dependencies) have limited support. Checkout the
  160. [Independent Watch App Sample](Example/watchOSSample).
  161. Keep in mind that macOS, tvOS, watchOS and Catalyst are not officially supported by Firebase, and this
  162. repository is actively developed primarily for iOS. While we can catch basic unit test issues with
  163. Travis, there may be some changes where the SDK no longer works as expected on macOS, tvOS or watchOS. If you
  164. encounter this, please [file an issue](https://github.com/firebase/firebase-ios-sdk/issues).
  165. During app setup in the console, you may get to a step that mentions something like "Checking if the app
  166. has communicated with our servers". This relies on Analytics and will not work on macOS/tvOS/watchOS/Catalyst.
  167. **It's safe to ignore the message and continue**, the rest of the SDKs will work as expected.
  168. To install, add a subset of the following to the Podfile:
  169. ```
  170. pod 'Firebase/ABTesting' # No watchOS support yet
  171. pod 'Firebase/Auth' # No watchOS support yet
  172. pod 'Firebase/Crashlytics' # No watchOS support yet
  173. pod 'Firebase/Database' # No watchOS support yet
  174. pod 'Firebase/Firestore' # No watchOS support yet
  175. pod 'Firebase/Functions' # No watchOS support yet
  176. pod 'Firebase/Messaging'
  177. pod 'Firebase/RemoteConfig' # No watchOS support yet
  178. pod 'Firebase/Storage'
  179. ```
  180. #### Additional Catalyst Notes
  181. * FirebaseAuth and FirebaseMessaging require adding `Keychain Sharing Capability`
  182. to Build Settings.
  183. * FirebaseFirestore requires signing the
  184. [gRPC Resource target](https://github.com/firebase/firebase-ios-sdk/issues/3500#issuecomment-518741681).
  185. ## Roadmap
  186. See [Roadmap](ROADMAP.md) for more about the Firebase iOS SDK Open Source
  187. plans and directions.
  188. ## Contributing
  189. See [Contributing](CONTRIBUTING.md) for more information on contributing to the Firebase
  190. iOS SDK.
  191. ## License
  192. The contents of this repository is licensed under the
  193. [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
  194. Your use of Firebase is governed by the
  195. [Terms of Service for Firebase Services](https://firebase.google.com/terms/).
  196. [gh-actions]: https://github.com/firebase/firebase-ios-sdk/actions
  197. [gh-auth-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/auth/badge.svg
  198. [gh-core-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/core/badge.svg
  199. [gh-datatransport-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/datatransport/badge.svg
  200. [gh-dynamiclinks-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/dynamiclinks/badge.svg
  201. [gh-firebasepod-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/firebasepod/badge.svg
  202. [gh-firestore-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/firestore/badge.svg
  203. [gh-interop-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/interop/badge.svg
  204. [gh-messaging-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/messaging/badge.svg
  205. [gh-storage-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/storage/badge.svg
  206. [gh-symbolcollision-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/symbolcollision/badge.svg
  207. [gh-zip-badge]: https://github.com/firebase/firebase-ios-sdk/workflows/zip/badge.svg