Skip to content

Commit

Permalink
add chinese iOS documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrixbirds committed Apr 4, 2019
1 parent 7ac1c96 commit 5aedacd
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 55 deletions.
Binary file added docs/v2/IOS_INSTALLATION/05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file modified docs/v2/IOS_INSTALLATION/06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/v2/IOS_INSTALLATION/07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/v2/IOS_INSTALLATION/08.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file modified docs/v2/IOS_INSTALLATION/10a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/v2/IOS_INSTALLATION/10b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/v2/IOS_INSTALLATION/11.png
Binary file not shown.
Binary file removed docs/v2/IOS_INSTALLATION/12.png
Binary file not shown.
Binary file added docs/v2/IOS_INSTALLATION/9a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/v2/IOS_INSTALLATION/9b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
64 changes: 32 additions & 32 deletions docs/v2/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Android 5.0+ x86 arm64 armv7a

#### 1. open up your terminal and write this :
When it comes to the version nr you can put any version you like as long as it it compatibility
When it comes to the version new release you can put any version you like as long as it is compatibility
```sh
$ react-native init agoraguide --version react-native@0.58
```
Expand All @@ -30,35 +30,35 @@ $ yarn add react-native-agora
```


#### 5. cd into your ios folder
#### 4. cd into your ios folder
```sh
$ cd ios
```

#### 6. we need to initialize pod
if you don't have cocopods installed run this command in your terminal
#### 5. we need to initialize pod
if you don't have CocoaPods installed run this command in your terminal
```sh
$ gem install Cocoapods
$ gem install cocoapods
```
after you have installed Cocopods run this command inside of your ios folder
after you have installed CocoaPods run this command inside of your ios folder
```sh
$ pod init
```
and then we need to install the pods
```sh
$ pod install
```
if you get a error from Cocopods saying something like this :
![Step 6](./IOS_INSTALLATION/06.png)
then you need to open up your "Podfile" and remove the part that is blue marked in the picture below
if you get a error from CocoaPods saying something like this :
![Step 5](./IOS_INSTALLATION/05.png)
then you need to open up your `Podfile` and remove the part that is blue marked in the picture below

#### *before*
![Step 6](./IOS_INSTALLATION/06a.png)
![Step 5](./IOS_INSTALLATION/05a.png)

#### *after*
![Step 6](./IOS_INSTALLATION/06b.png)
![Step 5](./IOS_INSTALLATION/05b.png)

we need to add this code at the bottom to our pod file
we need to add this code at the bottom to our `Podfile`
```sh
post_install do |installer|
installer.pods_project.targets.each do |target|
Expand All @@ -79,51 +79,51 @@ post_install do |installer|
end
```
This is how your podfile should look like
![Step 6](./IOS_INSTALLATION/06c.png)
![Step 5](./IOS_INSTALLATION/05c.png)
after that you can run this command again
```sh
$ pod install
```
#### 7. Open up your xcode project *[project name].xcworkspace* inside in ios folder
![Step 7](./IOS_INSTALLATION/07.png)
#### 6. Open up your Xcode project *[project name].xcworkspace* inside in ios folder
![Step 6](./IOS_INSTALLATION/06.png)
#### 8. expand your project folder and right click on the *"Libraries"* folder and choose *"add files to [project name]"*
![Step 8](./IOS_INSTALLATION/08.png)
#### 7. expand your project folder and right click on the *"Libraries"* folder and choose *"add files to [project name]"*
![Step 7](./IOS_INSTALLATION/07.png)
#### 9. follow the image below to find the RCTAgora lib
#### 8. follow the image below to find the RCTAgora lib
![Step 9](./IOS_INSTALLATION/09a.png)
![Step 8](./IOS_INSTALLATION/08a.png)
the path is node_modules => react-native-agora => ios => RCTAgora.xcodeproj
make sure you check so that those are checked
![Step 9](./IOS_INSTALLATION/09b.png)
![Step 8](./IOS_INSTALLATION/08b.png)
If the file is greyed out it means you already have it inside of you library folder.
Check so that RCTAgora.xcodeproj are inside of your "Libraries" folder
![Step 9](./IOS_INSTALLATION/09c.png)
![Step 8](./IOS_INSTALLATION/08c.png)
#### 10. we need to add the framework
#### 9. we need to add the framework
expand your "Frameworks" folder and you should see the "AgoraRtcEngineKit.framework" are red.
![Step 10](./IOS_INSTALLATION/10a.png)
![Step 9](./IOS_INSTALLATION/9a.png)
right click and delete that
Left click on your "RCTAgora.xcodeproj" and clöick on "Build Phases"
![Step 10](./IOS_INSTALLATION/10b.png)
Left click on your "RCTAgora.xcodeproj" and click on "Build Phases"
![Step 9](./IOS_INSTALLATION/9b.png)
left click on the "AgoraRtcEngineKit.framework" in the list and click on the "-"(minus sign) to remove it from the list.
![Step 10](./IOS_INSTALLATION/10c.png)
![Step 9](./IOS_INSTALLATION/9c.png)
then click on the "+"(plus sign) so that we can add the framework.
Click on the "Add other..." button
![Step 10](./IOS_INSTALLATION/10d.png)
![Step 9](./IOS_INSTALLATION/9d.png)
then we need to navigate and find our framwork
![Step 10](./IOS_INSTALLATION/10e.png)
![Step 9](./IOS_INSTALLATION/9e.png)
the path is : ios => Pods => AgoraRtcEngine_iOS => AgoraRtcEngineKit.framework and click on "add"
#### 11. at last we need to link the library
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)
![Step 11](./IOS_INSTALLATION/11.png)
#### 10. at last we need to link the library
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 "+"(plus sign)
![Step 10](./IOS_INSTALLATION/10a.png)
Search for libRCTAGora and click on add
![Step 11](./IOS_INSTALLATION/12.png)
![Step 10](./IOS_INSTALLATION/10b.png)
if you cant find it in your list check so that you dont already have it
----------------------------------------------
Expand Down
156 changes: 133 additions & 23 deletions docs/v2/ios.zh.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,144 @@
# iOS 开发搭建指南
#### 最低兼容
* React Native 0.58.x
* iOS SDK 8.0+
* Android 5.0+ x86 arm64 armv7a

# 环境
* 请先在项目里安装 `react-native-agora` & `react-native link react-native-agora`
* Xcode 10.0+
* 安装cocoapods
#### 1. 打开你的终端,输入如下命令:
对于新版本,你可以放置任何你喜欢的版本,只要它兼容。
```
$ react-native init agoraguide --version react-native@0.58
```

#### 2. cd 到你的项目目录
```sh
$ cd agoraguide
```

#### 3. 安装 react-native-agora

npm方式
```sh
$ npm install --save react-native-agora
```

yarn方式
```sh
$ yarn add react-native-agora
```

#### 4. cd 到你的ios目录
```sh
$ cd ios
```

```bash
# 需要首先安装好ruby
gem install cocoapods
#### 5. 安装pod
如果你没有安装过CocoaPods,在你的终端里输入以下命令并执行:
```sh
$ gem install Cocoapods
```
在成功安装CocoaPods后,在你项目的ios目录里执行以下命令:
```sh
$ pod init
```
接着执行安装pods
```sh
$ pod install
```
当你在安装pod过程中,遇到问题如下的报错时:
![Step 5](./IOS_INSTALLATION/05.png)
你需要打开`Podfile`并且如下图所示的蓝色部分。

#### *选中这部分*
![Step 5](./IOS_INSTALLATION/05a.png)

#### *删除后*
![Step 5](./IOS_INSTALLATION/05b.png)

`Podfile`底部加入以下代码:
```sh
post_install do |installer|
installer.pods_project.targets.each do |target|

# Step 1. 首先安装
```bash
pod install
# The following is needed to ensure the "archive" step works in XCode.
# It removes React & Yoga from the Pods project, as it is already included in the main project.
# Without this, you'd see errors when you archive like:
# "Multiple commands produce ... libReact.a"
# "Multiple commands produce ... libyoga.a"

targets_to_ignore = %w(React yoga)

if targets_to_ignore.include? target.name
target.remove_from_project
end

end
end
```
这是最终修改好的`Podfile`,如图所示。
![Step 5](./IOS_INSTALLATION/05c.png)
之后你就可以执行安装命令:
```
$ pod install
```
# Step 2. 使用xcode开启项目
打开 `ios/projectName.xcworkspace`
![Step 2](./IOS_INSTALLATION/1.2_OpenProject.png)
#### 6. 在你项目的ios目录里,打开Xcode工程文件 *[项目名].xcworkspace
![Step 6](./IOS_INSTALLATION/06.png)
#### 7. 展开你的项目目录,并且右键点击*"Libraries"* 目录并且选择*"add file to [project name]"*
![Step 7](./IOS_INSTALLATION/07.png)
#### 8. 按照下图去找到RCTAgora lib
![Step 8](./IOS_INSTALLATION/08a.png)
你可以沿路径找到:node_modules => react-native-agora => ios => RCTAgora.xcodeproj
请按照如图所示的方式确认你已经配好编译环境
![Step 8](./IOS_INSTALLATION/08b.png)
如果下图所示的文件是灰色的,请确保它的路径是在你的目录里的。
请检查`RCTAgora.xcodeproj`是否在`Libraries`目录中。
![Step 8](./IOS_INSTALLATION/08c.png)
#### 9. 检查你的Framework是否已经成功设置
展开你的 "Frameworks" 目录,如果看到红色的 "AgoraRtcEngineKit.framework",你需要按照以下步骤重新把它载入到编译环境。
![Step 9](./IOS_INSTALLATION/9a.png)
单击右键并删除。
单击左键 "RCTAgora.xcodeproj" 找到并点击 "Build Phases"
![Step 9](./IOS_INSTALLATION/9b.png)
在列表里找到 "AgoraRtcEngineKit.framework" 单击左键 找到 "-"(减号按钮) 把它从列表里删除。
![Step 9](./IOS_INSTALLATION/9c.png)
然后点击"+"(加号按钮) 点击"Add other..."按钮。
![Step 9](./IOS_INSTALLATION/9d.png)
按照图下方式,找到"AgoraRtcEngineKit.framework"
![Step 9](./IOS_INSTALLATION/9e.png)
你可以沿路径找到: ios => Pods => AgoraRtcEngine_iOS => AgoraRtcEngineKit.framework 并且点击 "add"
#### 10. 最后我们需要连接Library
点击你的项目左侧,并且点击"Build Phases"然后展开"Link Binary With Libraries"接着点击"+"(加号按钮)
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)
![Step 10](./IOS_INSTALLATION/10a.png)
找到 libRCTAgora 并且点击"add"
![Step 10](./IOS_INSTALLATION/10b.png)
如果你无法在列表里找到它,表明你还没安装它。
----------------------------------------------
### 常见故障排除
如果你遇到类似的报错:
![Step t1](./IOS_INSTALLATION/t01.png)
![Step t2](./IOS_INSTALLATION/t02.png)
可能是因为你有一些框架已经导入了相同的头文件,例如firestore库也会引入time.h,
展开你项目里的"Libraries" 并且点击"RCTAgora.xcodeproj"。然后点击"Build settings" 并且找到"Header search paths",按照以下方法设置。
![Step t3](./IOS_INSTALLATION/t03.png)
双击当前选中的路径
![Step t4](./IOS_INSTALLATION/t04.png)
把路径里的"recursive"修改成"non-recursive"
![Step t5](./IOS_INSTALLATION/t05.png)
# Step 3. 在项目里新增RCTAgora项目到Libraries目录里
![Step 3.1](./IOS_INSTALLATION/1.3_Add_Files_To_Project.png)
![Step 3.2](./IOS_INSTALLATION/1.3.1_RCTAgora.png)
根据以下的步骤。重新加载RCTAgora里面的AgoraRtcEngineKit。
![Step 3.3](./IOS_INSTALLATION/1.3.3_UPDATE_RCTAgora_AgoraRtcEngineKit_Framework.png)
![Step 3.4](./IOS_INSTALLATION/1.3.4_SELECT_AgoraRtcEngineKit_from_iOS_Pods_folder.png)
![Step 3.5](./IOS_INSTALLATION/1.3.5_DRAG_IT_INTO_Link_Binary_With_Libraries.png)
# Step 4. 把RCTAgora.a 添加到linked libraries里
![Step 4.3](./IOS_INSTALLATION/1.4.1_SET_RCTAgora.a.png)
# Step 5. xcode 编译并运行

0 comments on commit 5aedacd

Please sign in to comment.