準(zhǔn)備工作:下載doubango、idoubs源碼
mkdir mydoubs
cd mydoubs
Git clone https://github.com/DoubangoTelecom/doubango.git doubango
git clone https://github.com/DoubangoTelecom/idoubs.git idoubs
構(gòu)建demo應(yīng)用
1.創(chuàng)建一個(gè)文件夾MyPropertyManage(自己隨便命名) 在MyPropertyManage的文件夾下要有兩個(gè)平級(jí)文件夾
因?yàn)樵趇doubs里面的路徑被寫好啦(下面會(huì)說到),在MyPropertyManage文件夾里拖入doubango框架,
另外一個(gè)文件夾命名你開心就好(此處寫了idoubs),這個(gè)文件夾是用來裝你的工程的!

2.從源碼idoubs里面將iOS-ngn-stack整個(gè)文件以及common-ngn-stack這個(gè)文件夾拖入自己的工程文件下,
這里面包含著doubango的整個(gè)工程,所以這個(gè)文件夾很重要
3.在idoubs文件夾下將自己剛剛建好的Demo工程(此處命名ios-idoubs)拖入,與ios-ngn-stack平級(jí),
平級(jí)很重要,關(guān)乎工程內(nèi)路徑引入的問題!!
現(xiàn)在目錄結(jié)構(gòu)大概是這樣的

4.打開自己的工程demo 將ios-ngn-stack添加為項(xiàng)目引用
或者:關(guān)閉XCode打開的其他項(xiàng)目,只保留當(dāng)前的demo項(xiàng)目。 將ios-ngn-stack.xcodeproj從finder中拖放到demo項(xiàng)目內(nèi)。

5.添加鏈接庫
在demo項(xiàng)目的Build Phases中,在Link Binary With Libraries里添加各種需要的內(nèi)容。

libios_ngn_stack.a
libtinyBFCP.a
libtinySAK.a
libtinyNET.a
libtinySDP.a
libtinyRTP.a
libtinyIPSec.a
libtinyMSRP.a
libtinyHTTP.a
libtinyMEDIA.a
libtinySIGCOMP.a
libtinySMS.a
libtinyXCAP.a
libtinySIP.a
libtinyDAV.a
libtinyWRAP.a
QuartzCore.framework
OpenGLES.framework
Security.framework
CFNetwork.framework
AudioToolbox.framework
AddressBook.framework
CoreGraphics.framework
AVFoundation.framework
CoreMedia.framework
CoreVideo.framework
SystemConfiguration.framework
AddressBook.framework
libsqlite3.tbd
libresolv.tbd
6.配置Build Settings
①User-Defined

DOUBANGO_HOME ../../doubango DOUBANGO_LIBS $DOUBANGO_HOME/thirdparties/iphone/lib/universal NGN_STACK_HOME $DOUBANGO_HOME/thirdparties/iphone/lib/universal PREBINDING NO
②Linking/Other Linker Flags

-lsrtp -lssl -lcrypto -lyuv -lvpx -lx264 -lopenh264 -lswscale -lavutil -lavcodec -lopus -lgsm -lg729b -lspeex -lspeexdsp -framework Foundation -framework UIKit
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
③Search Paths/Header Search Paths

$NGN_STACK_HOME/common-ngn-stack $NGN_STACK_HOME/ios-ngn-stack $DOUBANGO_HOME/bindings/_common $DOUBANGO_HOME/tinySMS/include $DOUBANGO_HOME/tinyHTTP/include $DOUBANGO_HOME/tinySIP/include $DOUBANGO/HOME/tinyMSRP/include $DOUBANGO_HOME/tinyMEDIA/include $DOUBANGO_HOME/tinyNET/src $DOUBANGO_HOME/tinySAK/src $DOUBANGO_HOME/tinyDAV/include $DOUBANGO_HOME/thirdparties/common/include ../common-ngn-stack ../ios-ngn-stack
④Search Paths/Library Search Paths

$(inherited) $DOUBANGO_LIBS
⑤Apple LLVM 7.1 - Custom Compiler Flags / Other C Flags

-DNS_BLOCK_ASSERTIONS=1
⑥Build Settings / Apple LLVM 7.1 - Language 下的Compile Sources As為Objective-C++

⑦加入頭文件
在ViewController.h中,加入頭文件
import “iOSNgnStack.h”
此外注意點(diǎn):
當(dāng)你們創(chuàng)建的控制器只要用到ios-ngn-stack里面的東西的話,控制器的后綴一定要改成.mm好嗎 讓它們混編好嗎 寶寶們
因?yàn)槿绻悴贿@么做的話 編譯會(huì)變成這樣的錯(cuò)誤:

最后,謝謝我的同事陳老師!
補(bǔ)充:
有網(wǎng)上的朋友配置的時(shí)候出現(xiàn)這樣的問題:
問題1:
解決:
這個(gè)問題出現(xiàn)在沒按配置把doubango放在最外層 詳細(xì)看第一步驟
問題2:

解決:
這個(gè)問題就是沒有配置Linking/Other Linker Flags 詳細(xì)翻到上面尋找。
posted on 2016-11-04 23:35
聶文龍 閱讀(604)
評(píng)論(0) 編輯 收藏 引用