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.

193 lines
7.8 KiB

  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, FirebaseInAppMessagingDisplay, FirebaseMessaging and
  5. 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. Travis will verify that any code changes are done in a style compliant way. Install
  63. `clang-format` and `swiftformat`.
  64. This command will get the right `clang-format` version:
  65. `brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/773cb75d360b58f32048f5964038d09825a507c8/Formula/clang-format.rb`
  66. ### Running Unit Tests
  67. Select a scheme and press Command-u to build a component and run its unit tests.
  68. ### Running Sample Apps
  69. In order to run the sample apps and integration tests, you'll need valid
  70. `GoogleService-Info.plist` files for those samples. The Firebase Xcode project contains dummy plist
  71. files without real values, but can be replaced with real plist files. To get your own
  72. `GoogleService-Info.plist` files:
  73. 1. Go to the [Firebase Console](https://console.firebase.google.com/)
  74. 2. Create a new Firebase project, if you don't already have one
  75. 3. For each sample app you want to test, create a new Firebase app with the sample app's bundle
  76. identifier (e.g. `com.google.Database-Example`)
  77. 4. Download the resulting `GoogleService-Info.plist` and replace the appropriate dummy plist file
  78. (e.g. in [Example/Database/App/](Example/Database/App/));
  79. Some sample apps like Firebase Messaging ([Example/Messaging/App](Example/Messaging/App)) require
  80. special Apple capabilities, and you will have to change the sample app to use a unique bundle
  81. identifier that you can control in your own Apple Developer account.
  82. ## Specific Component Instructions
  83. See the sections below for any special instructions for those components.
  84. ### Firebase Auth
  85. If you're doing specific Firebase Auth development, see
  86. [the Auth Sample README](Example/Auth/README.md) for instructions about
  87. building and running the FirebaseAuth pod along with various samples and tests.
  88. ### Firebase Database
  89. To run the Database Integration tests, make your database authentication rules
  90. [public](https://firebase.google.com/docs/database/security/quickstart).
  91. ### Firebase Storage
  92. To run the Storage Integration tests, follow the instructions in
  93. [FIRStorageIntegrationTests.m](Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m).
  94. #### Push Notifications
  95. Push notifications can only be delivered to specially provisioned App IDs in the developer portal.
  96. In order to actually test receiving push notifications, you will need to:
  97. 1. Change the bundle identifier of the sample app to something you own in your Apple Developer
  98. account, and enable that App ID for push notifications.
  99. 2. You'll also need to
  100. [upload your APNs Provider Authentication Key or certificate to the Firebase Console](https://firebase.google.com/docs/cloud-messaging/ios/certs)
  101. at **Project Settings > Cloud Messaging > [Your Firebase App]**.
  102. 3. Ensure your iOS device is added to your Apple Developer portal as a test device.
  103. #### iOS Simulator
  104. The iOS Simulator cannot register for remote notifications, and will not receive push notifications.
  105. In order to receive push notifications, you'll have to follow the steps above and run the app on a
  106. physical device.
  107. ## Community Supported Efforts
  108. We've seen an amazing amount of interest and contributions to improve the Firebase SDKs, and we are
  109. very grateful! We'd like to empower as many developers as we can to be able to use Firebase and
  110. participate in the Firebase community.
  111. ### macOS and tvOS
  112. FirebaseAuth, FirebaseCore, FirebaseDatabase and FirebaseStorage now compile, run unit tests, and
  113. work on macOS and tvOS, thanks to contributions from the community. There are a few tweaks needed,
  114. like ensuring iOS-only, macOS-only, or tvOS-only code is correctly guarded with checks for
  115. `TARGET_OS_IOS`, `TARGET_OS_OSX` and `TARGET_OS_TV`.
  116. For tvOS, checkout the [Sample](Example/tvOSSample).
  117. Keep in mind that macOS and tvOS are not officially supported by Firebase, and this repository is
  118. actively developed primarily for iOS. While we can catch basic unit test issues with Travis, there
  119. may be some changes where the SDK no longer works as expected on macOS or tvOS. If you encounter
  120. this, please [file an issue](https://github.com/firebase/firebase-ios-sdk/issues).
  121. For installation instructions, see [above](README.md#accessing-firebase-source-snapshots).
  122. Note that the Firebase pod is not available for macOS and tvOS. Install a selection of the
  123. `FirebaseAuth`, `FirebaseCore`, `FirebaseDatabase` and `FirebaseStorage` CocoaPods.
  124. ## Roadmap
  125. See [Roadmap](ROADMAP.md) for more about the Firebase iOS SDK Open Source
  126. plans and directions.
  127. ## Contributing
  128. See [Contributing](CONTRIBUTING.md) for more information on contributing to the Firebase
  129. iOS SDK.
  130. ## License
  131. The contents of this repository is licensed under the
  132. [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
  133. Your use of Firebase is governed by the
  134. [Terms of Service for Firebase Services](https://firebase.google.com/terms/).