1.首先你要到https://webrtc.org/native-code/ios 上各種蛋疼下載源碼
目錄入下圖:
2.因?yàn)橐獔?zhí)行depot_tools里面的ninja 和 gn 命令氏堤,所以要定義一個(gè)全局變量邻悬。
(即:在bash_profile中添加depot_tools的路徑:export PATH=‘/Users/x x/Work/WebRTC/ios/depot_tools’:${PATH} )
a. 啟動(dòng)終端,當(dāng)前路徑為:/Users/xxxx
b. 把depot_tools 設(shè)置到PATH中
vi ~/.bash_profile
輸入 export PATH=depot_tools路徑 :$PATH
按“ESC”艰猬,輸入 ":wq!" 保存退出议经;
source ~/.bash_profile 使PATH設(shè)置立即生效
echo $PATH 查看設(shè)置是否生效斧账。
-
編譯獲得 32或者64 demo
D7BF2041-A568-40F7-9CAC-B545FE443FDF.png
(如果此時(shí)編譯時(shí)報(bào)有: xcode-select: error: tool 'xcodebuild' requires Xcode ,這是因?yàn)槎鄠€(gè)Xcode重名后煞肾,xcodebuild找不到原來的Xcode了咧织,解決方法:xcode-select -switch 新的xcode路徑,如: sudo xcode-select -switch /Applications/Xcode\ 8.1.app 籍救,就可以了拯爽。 )
最后編譯Xcode工程
4.編譯WebRTC.FrameWork
進(jìn)入src->webrtc->build->iOS 執(zhí)行build_ios_libs.sh. 中的 build_webrtc
5.編譯完成后可能會(huì)遇到證書的問題
報(bào)錯(cuò):如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 等等這個(gè)錯(cuò)誤是由于mac os 上同時(shí)存在多個(gè)簽名證書造成的。
解決:a. 打開終端輸入: security find-identity 查看本機(jī)上具有多少個(gè)有效簽名钧忽,有效簽名為Valid identities only下面列出來的毯炮。
b.然后輸入:find . -name common.gypi | xargs grep CODE_SIGN_IDENTITY 查看當(dāng)前weRTCDemo中的實(shí)際簽名,如果不一致耸黑,根據(jù)路徑更改過來