Browse Source

updated readme file

this is a proposal for the README file
Cyrus Zei 5 years ago
parent
commit
fc6e3dbe2c
No account linked to committer's email address
1 changed files with 145 additions and 26 deletions
  1. 145
    26
      docs/v2/ios.md

+ 145
- 26
docs/v2/ios.md View File

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