|
@@ -1,53 +1,149 @@
|
1
|
|
-# iOS Installation
|
|
1
|
+# React native Agora iOS Installation
|
|
2
|
+#### Minimum compatibility
|
|
3
|
+* React native 0.58.x
|
|
4
|
+* IOS SDK 8.0+
|
|
5
|
+* Android 5.0+ x86 arm64 armv7a
|
2
|
6
|
|
3
|
|
-# Prerequisites
|
4
|
|
-* You should installed and linked `react-native-agora`
|
5
|
|
-* Xcode 10.0+
|
6
|
|
-* cocoapods
|
|
7
|
+#### 1. open up your terminal and write this :
|
|
8
|
+When it comes to the version nr you can put any version you like as long as it it compatibility
|
|
9
|
+```sh
|
|
10
|
+$ react-native init agoraguide --version react-native@0.58
|
|
11
|
+```
|
7
|
12
|
|
8
|
|
-```bash
|
9
|
|
-# Use npm
|
10
|
|
-npm install react-native-agora
|
|
13
|
+#### 2. cd into your project folder
|
|
14
|
+```sh
|
|
15
|
+$ cd agoraguide
|
11
|
16
|
```
|
12
|
|
-or
|
|
17
|
+#### 3. install npm package react-native-agora
|
|
18
|
+
|
|
19
|
+with npm
|
13
|
20
|
|
14
|
|
-```bash
|
15
|
|
-# Use yarn
|
16
|
|
-yarn add react-native-agora
|
|
21
|
+
|
|
22
|
+```sh
|
|
23
|
+$ npm install --save react-native-agora
|
17
|
24
|
```
|
18
|
|
-then you need to link the library
|
19
|
25
|
|
20
|
|
-```bash
|
21
|
|
-# Link the library
|
22
|
|
-react-native link react-native-agora
|
|
26
|
+or yarn
|
|
27
|
+
|
|
28
|
+```sh
|
|
29
|
+$ yarn add react-native-agora
|
23
|
30
|
```
|
24
|
31
|
|
25
|
32
|
|
26
|
|
-```bash
|
27
|
|
-# installed ruby first then run it
|
28
|
|
-gem install cocoapods
|
|
33
|
+#### 5. cd into your ios folder
|
|
34
|
+```sh
|
|
35
|
+$ cd ios
|
29
|
36
|
```
|
30
|
37
|
|
31
|
|
-# Step 1. install pod dependencies
|
32
|
|
-```bash
|
33
|
|
-cd ios
|
34
|
|
-pod install
|
|
38
|
+#### 6. we need to initialize pod
|
|
39
|
+if you don't have cocopods installed run this command in your terminal
|
|
40
|
+```sh
|
|
41
|
+$ gem install Cocoapods
|
35
|
42
|
```
|
36
|
|
-pod install success will create `<projectName>`.xcworkspace file in ios folder.
|
|
43
|
+after you have installed Cocopods run this command inside of your ios folder
|
|
44
|
+```sh
|
|
45
|
+$ pod init
|
|
46
|
+```
|
|
47
|
+and then we need to install the pods
|
|
48
|
+```sh
|
|
49
|
+$ pod install
|
|
50
|
+```
|
|
51
|
+if you get a error from Cocopods saying something like this :
|
|
52
|
+![Step 6](./IOS_INSTALLATION/06.png)
|
|
53
|
+then you need to open up your "Podfile" and remove the part that is blue marked in the picture below
|
|
54
|
+
|
|
55
|
+#### *before*
|
|
56
|
+![Step 6](./IOS_INSTALLATION/06a.png)
|
|
57
|
+
|
|
58
|
+#### *after*
|
|
59
|
+![Step 6](./IOS_INSTALLATION/06b.png)
|
|
60
|
+
|
|
61
|
+we need to add this code at the bottom to our pod file
|
|
62
|
+```sh
|
|
63
|
+post_install do |installer|
|
|
64
|
+ installer.pods_project.targets.each do |target|
|
|
65
|
+
|
|
66
|
+ # The following is needed to ensure the "archive" step works in XCode.
|
|
67
|
+ # It removes React & Yoga from the Pods project, as it is already included in the main project.
|
|
68
|
+ # Without this, you'd see errors when you archive like:
|
|
69
|
+ # "Multiple commands produce ... libReact.a"
|
|
70
|
+ # "Multiple commands produce ... libyoga.a"
|
|
71
|
+
|
|
72
|
+ targets_to_ignore = %w(React yoga)
|
|
73
|
+
|
|
74
|
+ if targets_to_ignore.include? target.name
|
|
75
|
+ target.remove_from_project
|
|
76
|
+ end
|
|
77
|
+
|
|
78
|
+ end
|
|
79
|
+end
|
|
80
|
+```
|
|
81
|
+This is how your podfile should look like
|
|
82
|
+![Step 6](./IOS_INSTALLATION/06c.png)
|
|
83
|
+after that you can run this command again
|
|
84
|
+```sh
|
|
85
|
+$ pod install
|
|
86
|
+```
|
|
87
|
+
|
|
88
|
+#### 7. Open up your xcode project *[project name].xcworkspace* inside in ios folder
|
|
89
|
+![Step 7](./IOS_INSTALLATION/07.png)
|
|
90
|
+
|
|
91
|
+#### 8. expand your project folder and right click on the *"Libraries"* folder and choose *"add files to [project name]"*
|
|
92
|
+![Step 8](./IOS_INSTALLATION/08.png)
|
|
93
|
+
|
|
94
|
+#### 9. follow the image below to find the RCTAgora lib
|
|
95
|
+
|
|
96
|
+![Step 9](./IOS_INSTALLATION/09a.png)
|
|
97
|
+the path is node_modules => react-native-agora => ios => RCTAgora.xcodeproj
|
|
98
|
+
|
|
99
|
+make sure you check so that those are checked
|
|
100
|
+
|
|
101
|
+![Step 9](./IOS_INSTALLATION/09b.png)
|
|
102
|
+
|
|
103
|
+If the file is greyed out it means you already have it inside of you library folder.
|
|
104
|
+Check so that RCTAgora.xcodeproj are inside of your "Libraries" folder
|
|
105
|
+![Step 9](./IOS_INSTALLATION/09c.png)
|
|
106
|
+
|
|
107
|
+#### 10. we need to add the framework
|
|
108
|
+expand your "Frameworks" folder and you should see the "AgoraRtcEngineKit.framework" are red.
|
|
109
|
+![Step 10](./IOS_INSTALLATION/10a.png)
|
|
110
|
+right click and delete that
|
|
111
|
+Left click on your "RCTAgora.xcodeproj" and clöick on "Build Phases"
|
|
112
|
+![Step 10](./IOS_INSTALLATION/10b.png)
|
|
113
|
+left click on the "AgoraRtcEngineKit.framework" in the list and click on the "-"(minus sign) to remove it from the list.
|
|
114
|
+![Step 10](./IOS_INSTALLATION/10c.png)
|
|
115
|
+then click on the "+"(plus sign) so that we can add the framework.
|
|
116
|
+Click on the "Add other..." button
|
|
117
|
+![Step 10](./IOS_INSTALLATION/10d.png)
|
|
118
|
+then we need to navigate and find our framwork
|
|
119
|
+![Step 10](./IOS_INSTALLATION/10e.png)
|
|
120
|
+the path is : ios => Pods => AgoraRtcEngine_iOS => AgoraRtcEngineKit.framework and click on "add"
|
|
121
|
+
|
|
122
|
+#### 11. at last we need to link the library
|
|
123
|
+click on your project on the left and then click on "Build Phases" and then expand "Link Binary With Libraries" and then click on the "+"(plug sign)
|
|
124
|
+![Step 11](./IOS_INSTALLATION/11.png)
|
|
125
|
+Search for libRCTAGora and click on add
|
|
126
|
+![Step 11](./IOS_INSTALLATION/12.png)
|
|
127
|
+if you cant find it in your list check so that you dont already have it
|
|
128
|
+
|
|
129
|
+----------------------------------------------
|
|
130
|
+### Troubleshooting
|
|
131
|
+
|
|
132
|
+if you get some errors like the pictures below
|
|
133
|
+![Step t1](./IOS_INSTALLATION/t01.png)
|
|
134
|
+![Step t2](./IOS_INSTALLATION/t02.png)
|
|
135
|
+
|
|
136
|
+the chances are that you have some framework that already have imported time.h something like firestore.
|
|
137
|
+
|
|
138
|
+Expand your "Libraries" and then click on "RCTAgora.xcodeproj". Then click on "Build settings" and search for "Header search paths"
|
|
139
|
+![Step t3](./IOS_INSTALLATION/t03.png)
|
|
140
|
+Doubble click on the path
|
|
141
|
+![Step t4](./IOS_INSTALLATION/t04.png)
|
|
142
|
+and change the Pods path from "recursive" to non-recursive
|
|
143
|
+![Step t5](./IOS_INSTALLATION/t05.png)
|
|
144
|
+
|
|
145
|
+
|
37
|
146
|
|
38
|
|
-# Step 2. Open the xcworkspace Project in Xcode
|
39
|
|
-Open `ios/projectName.xcworkspace` with XCode
|
40
|
|
-![Step 2](./IOS_INSTALLATION/1.2_OpenProject.png)
|
41
|
147
|
|
42
|
|
-# Step 3. Add RCTAgora to the Project Libraries folder
|
43
|
|
-![Step 3.1](./IOS_INSTALLATION/1.3_Add_Files_To_Project.png)
|
44
|
|
-![Step 3.2](./IOS_INSTALLATION/1.3.1_RCTAgora.png)
|
45
|
|
-select the AgoraRtcEngineKit and re-added by below steps.
|
46
|
|
-![Step 3.3](./IOS_INSTALLATION/1.3.3_UPDATE_RCTAgora_AgoraRtcEngineKit_Framework.png)
|
47
|
|
-![Step 3.4](./IOS_INSTALLATION/1.3.4_SELECT_AgoraRtcEngineKit_from_iOS_Pods_folder.png)
|
48
|
|
-![Step 3.5](./IOS_INSTALLATION/1.3.5_DRAG_IT_INTO_Link_Binary_With_Libraries.png)
|
49
|
148
|
|
50
|
|
-# Step 4. Only Add Linked Library to the xcode project
|
51
|
|
-![Step 4.3](./IOS_INSTALLATION/1.4.1_SET_RCTAgora.a.png)
|
52
|
149
|
|
53
|
|
-# Step 5. build and run it with xcode
|