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.

219 lines
8.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. # Firebase iOS Open Source Development [![Build Status](https://travis-ci.org/firebase/firebase-ios-sdk.svg?branch=master)](https://travis-ci.org/firebase/firebase-ios-sdk)
  2. This repository contains a subset of the Firebase iOS SDK source. It currently
  3. includes FirebaseCore, FirebaseAuth, FirebaseDatabase, FirebaseFirestore,
  4. FirebaseFunctions, FirebaseInstanceID, FirebaseInAppMessaging,
  5. FirebaseInAppMessagingDisplay, FirebaseMessaging and FirebaseStorage.
  6. The repository also includes GoogleUtilities source. The
  7. [GoogleUtilities](GoogleUtilities/README.md) pod is
  8. a set of utilities used by Firebase and other Google products.
  9. Firebase is an app development platform with tools to help you build, grow and
  10. monetize your app. More information about Firebase can be found at
  11. [https://firebase.google.com](https://firebase.google.com).
  12. ## Installation
  13. See the three subsections for details about three different installation methods.
  14. 1. [Standard pod install](README.md#standard-pod-install)
  15. 1. [Installing from the GitHub repo](README.md#installing-from-github)
  16. 1. [Experimental Carthage](README.md#carthage-ios-only)
  17. ### Standard pod install
  18. Go to
  19. [https://firebase.google.com/docs/ios/setup](https://firebase.google.com/docs/ios/setup).
  20. ### Installing from GitHub
  21. For releases starting with 5.0.0, the source for each release is also deployed
  22. to CocoaPods master and available via standard
  23. [CocoaPods Podfile syntax](https://guides.cocoapods.org/syntax/podfile.html#pod).
  24. These instructions can be used to access the Firebase repo at other branches,
  25. tags, or commits.
  26. #### Background
  27. See
  28. [the Podfile Syntax Reference](https://guides.cocoapods.org/syntax/podfile.html#pod)
  29. for instructions and options about overriding pod source locations.
  30. #### Accessing Firebase Source Snapshots
  31. All of the official releases are tagged in this repo and available via CocoaPods. To access a local
  32. source snapshot or unreleased branch, use Podfile directives like the following:
  33. To access FirebaseFirestore via a branch:
  34. ```
  35. pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
  36. pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master'
  37. ```
  38. To access FirebaseMessaging via a checked out version of the firebase-ios-sdk repo do:
  39. ```
  40. pod 'FirebaseCore', :path => '/path/to/firebase-ios-sdk'
  41. pod 'FirebaseMessaging', :path => '/path/to/firebase-ios-sdk'
  42. ```
  43. ### Carthage (iOS only)
  44. Instructions for the experimental Carthage distribution are at
  45. [Carthage](Carthage.md).
  46. ### Rome
  47. Instructions for installing binary frameworks via
  48. [Rome](https://github.com/CocoaPods/Rome) are at [Rome](Rome.md).
  49. ## Development
  50. Follow the subsequent instructions to develop, debug, unit test, run integration
  51. tests, and try out reference samples:
  52. ```
  53. $ git clone git@github.com:firebase/firebase-ios-sdk.git
  54. $ cd firebase-ios-sdk/Example
  55. $ pod update
  56. $ open Firebase.xcworkspace
  57. ```
  58. Firestore and Functions have self contained Xcode projects. See
  59. [Firestore/README.md](Firestore/README.md) and
  60. [Functions/README.md](Functions/README.md).
  61. ### Code Formatting
  62. To ensure that the code is formatted consistently, run the script
  63. [./scripts/style.sh](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/style.sh)
  64. before creating a PR.
  65. Travis will verify that any code changes are done in a style compliant way. Install
  66. `clang-format` and `swiftformat`.
  67. These commands will get the right versions:
  68. ```
  69. brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/773cb75d360b58f32048f5964038d09825a507c8/Formula/clang-format.rb
  70. brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3dfea1004e0736754bbf49673cca8aaed8a94089/Formula/swiftformat.rb
  71. ```
  72. Note: if you already have a newer version of these installed you may need to
  73. `brew switch` to this version.
  74. ### Running Unit Tests
  75. Select a scheme and press Command-u to build a component and run its unit tests.
  76. #### Viewing Code Coverage
  77. First, make sure that [xcov](https://github.com/nakiostudio/xcov) is installed with `gem install xcov`.
  78. After running the `AllUnitTests_iOS` scheme in Xcode, execute
  79. `xcov --workspace Firebase.xcworkspace --scheme AllUnitTests_iOS --output_directory xcov_output`
  80. at Example/ in the terminal. This will aggregate the coverage, and you can run `open xcov_output/index.html` to see the results.
  81. ### Running Sample Apps
  82. In order to run the sample apps and integration tests, you'll need valid
  83. `GoogleService-Info.plist` files for those samples. The Firebase Xcode project contains dummy plist
  84. files without real values, but can be replaced with real plist files. To get your own
  85. `GoogleService-Info.plist` files:
  86. 1. Go to the [Firebase Console](https://console.firebase.google.com/)
  87. 2. Create a new Firebase project, if you don't already have one
  88. 3. For each sample app you want to test, create a new Firebase app with the sample app's bundle
  89. identifier (e.g. `com.google.Database-Example`)
  90. 4. Download the resulting `GoogleService-Info.plist` and replace the appropriate dummy plist file
  91. (e.g. in [Example/Database/App/](Example/Database/App/));
  92. Some sample apps like Firebase Messaging ([Example/Messaging/App](Example/Messaging/App)) require
  93. special Apple capabilities, and you will have to change the sample app to use a unique bundle
  94. identifier that you can control in your own Apple Developer account.
  95. ## Specific Component Instructions
  96. See the sections below for any special instructions for those components.
  97. ### Firebase Auth
  98. If you're doing specific Firebase Auth development, see
  99. [the Auth Sample README](Example/Auth/README.md) for instructions about
  100. building and running the FirebaseAuth pod along with various samples and tests.
  101. ### Firebase Database
  102. To run the Database Integration tests, make your database authentication rules
  103. [public](https://firebase.google.com/docs/database/security/quickstart).
  104. ### Firebase Storage
  105. To run the Storage Integration tests, follow the instructions in
  106. [FIRStorageIntegrationTests.m](Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m).
  107. #### Push Notifications
  108. Push notifications can only be delivered to specially provisioned App IDs in the developer portal.
  109. In order to actually test receiving push notifications, you will need to:
  110. 1. Change the bundle identifier of the sample app to something you own in your Apple Developer
  111. account, and enable that App ID for push notifications.
  112. 2. You'll also need to
  113. [upload your APNs Provider Authentication Key or certificate to the Firebase Console](https://firebase.google.com/docs/cloud-messaging/ios/certs)
  114. at **Project Settings > Cloud Messaging > [Your Firebase App]**.
  115. 3. Ensure your iOS device is added to your Apple Developer portal as a test device.
  116. #### iOS Simulator
  117. The iOS Simulator cannot register for remote notifications, and will not receive push notifications.
  118. In order to receive push notifications, you'll have to follow the steps above and run the app on a
  119. physical device.
  120. ## Community Supported Efforts
  121. We've seen an amazing amount of interest and contributions to improve the Firebase SDKs, and we are
  122. very grateful! We'd like to empower as many developers as we can to be able to use Firebase and
  123. participate in the Firebase community.
  124. ### macOS and tvOS
  125. Thanks to contributions from the community, FirebaseAuth, FirebaseCore, FirebaseDatabase, FirebaseMessaging,
  126. FirebaseFirestore, FirebaseFunctions and FirebaseStorage now compile, run unit tests, and work on
  127. macOS and tvOS.
  128. For tvOS, checkout the [Sample](Example/tvOSSample).
  129. Keep in mind that macOS and tvOS are not officially supported by Firebase, and this repository is
  130. actively developed primarily for iOS. While we can catch basic unit test issues with Travis, there
  131. may be some changes where the SDK no longer works as expected on macOS or tvOS. If you encounter
  132. this, please [file an issue](https://github.com/firebase/firebase-ios-sdk/issues).
  133. Note that the Firebase pod is not available for macOS and tvOS.
  134. To install, add a subset of the following to the Podfile:
  135. ```
  136. pod 'FirebaseAuth'
  137. pod 'FirebaseCore'
  138. pod 'FirebaseDatabase'
  139. pod 'FirebaseFirestore' # Only iOS and macOS
  140. pod 'FirebaseFunctions'
  141. pod 'FirebaseMessaging' # Only iOS and tvOS
  142. pod 'FirebaseStorage'
  143. ```
  144. ## Roadmap
  145. See [Roadmap](ROADMAP.md) for more about the Firebase iOS SDK Open Source
  146. plans and directions.
  147. ## Contributing
  148. See [Contributing](CONTRIBUTING.md) for more information on contributing to the Firebase
  149. iOS SDK.
  150. ## License
  151. The contents of this repository is licensed under the
  152. [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
  153. Your use of Firebase is governed by the
  154. [Terms of Service for Firebase Services](https://firebase.google.com/terms/).