iOS 编译webRTC

1.首先你要到https://webrtc.org/native-code/ios 上各种蛋疼下载源码
目录入下图:

iOS 编译webRTC_第1张图片
CCCDEA91-06A8-4467-92B6-544DE7B4F792.png

2.因为要执行depot_tools里面的ninja 和 gn 命令,所以要定义一个全局变量。
(即:在bash_profile中添加depot_tools的路径:export PATH=‘/Users/x x/Work/WebRTC/ios/depot_tools’:${PATH} )

a. 启动终端,当前路径为:/Users/xxxx
b. 把depot_tools 设置到PATH中
vi ~/.bash_profile
输入 export PATH=depot_tools路径 :$PATH
按“ESC”,输入 ":wq!" 保存退出;
source ~/.bash_profile 使PATH设置立即生效
echo $PATH 查看设置是否生效。

iOS 编译webRTC_第2张图片
68F91543-BB1B-4ADC-B9F7-757EA0472C09.png
  1. 编译获得 32或者64 demo


    iOS 编译webRTC_第3张图片
    D7BF2041-A568-40F7-9CAC-B545FE443FDF.png

(如果此时编译时报有: xcode-select: error: tool 'xcodebuild' requires Xcode ,这是因为多个Xcode重名后,xcodebuild找不到原来的Xcode了,解决方法:xcode-select -switch 新的xcode路径,如: sudo xcode-select -switch /Applications/Xcode\ 8.1.app ,就可以了。 )

最后编译Xcode工程

iOS 编译webRTC_第4张图片
0612BF3A-D2C5-4185-B17E-B42B3AEE3CDF.png

4.编译WebRTC.FrameWork

iOS 编译webRTC_第5张图片
BD541C76-D704-4087-8EE5-FFE774C86C9E.png

进入src->webrtc->build->iOS 执行build_ios_libs.sh. 中的 build_webrtc

E861F62C-11B6-47B7-B108-AB782CBC0305.png

5.编译完成后可能会遇到证书的问题
报错:如Tried to prepare a device build without specifying a code signing
identity and could not detect one automatically either.
TIP: Simulator builds don't require code signing... 或者AssertionError: Multiple codesigning fingerprints for identity: iPhone Developer 等等这个错误是由于mac os 上同时存在多个签名证书造成的。

解决:a. 打开终端输入: security find-identity 查看本机上具有多少个有效签名,有效签名为Valid identities only下面列出来的。
b.然后输入:find . -name common.gypi | xargs grep CODE_SIGN_IDENTITY 查看当前weRTCDemo中的实际签名,如果不一致,根据路径更改过来

iOS 编译webRTC_第6张图片
BB631142-FF64-4236-B06C-2AAFAD7842D3.png
iOS 编译webRTC_第7张图片
35E83669-14DC-491E-8CAA-9109D6CFFDC5.png

你可能感兴趣的:(iOS 编译webRTC)