Skip to content

Commit 419320b

Browse files
authored
Create installation.ios.md
1 parent 045858b commit 419320b

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

docs/installation.ios.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#iOS Installation
2+
3+
### cocoapods
4+
5+
Unfortunately, due to AppStore restrictions, we currently do _not_ package Firebase libraries in with Firestack. However, the good news is we've automated the process (with many thanks to the Auth0 team for inspiration) of setting up with cocoapods. This will happen automatically upon linking the package with `react-native-cli`.
6+
7+
**Remember to use the `ios/[YOUR APP NAME].xcworkspace` instead of the `ios/[YOUR APP NAME].xcproj` file from now on**.
8+
9+
We need to link the package with our development packaging. We have two options to handle linking:
10+
11+
#### Automatically with react-native-cli
12+
13+
React native ships with a `link` command that can be used to link the projects together, which can help automate the process of linking our package environments.
14+
15+
```bash
16+
react-native link react-native-firestack
17+
```
18+
19+
Update the newly installed pods once the linking is done:
20+
21+
```bash
22+
cd ios && pod update --verbose
23+
```
24+
25+
#### Manually
26+
27+
If you prefer not to use `react-native link`, we can manually link the package together with the following steps, after `npm install`:
28+
29+
A. In XCode, right click on `Libraries` and find the `Add Files to [project name]`.
30+
31+
![Add library to project](http://d.pr/i/2gEH.png)
32+
33+
B. Add the `node_modules/react-native-firestack/ios/Firestack.xcodeproj`
34+
35+
![Firebase.xcodeproj in Libraries listing](http://d.pr/i/19ktP.png)
36+
37+
C. Ensure that the `Build Settings` of the `Firestack.xcodeproj` project is ticked to _All_ and it's `Header Search Paths` include both of the following paths _and_ are set to _recursive_:
38+
39+
1. `$(SRCROOT)/../../react-native/React`
40+
2. `$(SRCROOT)/../node_modules/react-native/React`
41+
3. `${PROJECT_DIR}/../../../ios/Pods`
42+
43+
![Recursive paths](http://d.pr/i/1hAr1.png)
44+
45+
D. Setting up cocoapods
46+
47+
Since we're dependent upon cocoapods (or at least the Firebase libraries being available at the root project -- i.e. your application), we have to make them available for Firestack to find them.
48+
49+
Using cocoapods is the easiest way to get started with this linking. Add or update a `Podfile` at `ios/Podfile` in your app with the following:
50+
51+
```ruby
52+
source 'https://github.com/CocoaPods/Specs.git'
53+
[
54+
'Firebase/Core',
55+
'Firebase/Auth',
56+
'Firebase/Storage',
57+
'Firebase/Database',
58+
'Firebase/RemoteConfig',
59+
'Firebase/Messaging'
60+
].each do |lib|
61+
pod lib
62+
end
63+
```
64+
65+
Then you can run `(cd ios && pod install)` to get the pods opened. If you do use this route, remember to use the `.xcworkspace` file.
66+
67+
If you don't want to use cocoapods, you don't need to use it! Just make sure you link the Firebase libraries in your project manually. For more information, check out the relevant Firebase docs at [https://firebase.google.com/docs/ios/setup#frameworks](https://firebase.google.com/docs/ios/setup#frameworks).

0 commit comments

Comments
 (0)