我想将PJSIP集成到我的项目中,我正在按照网站(https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone)的步骤进行操作。我能够按照他们的说法制作一个项目。但我知道我想融入我的快速项目。任何人都可以指导我,如何在我的代码中集成PJSIP库和其他代码。现在,我在swift对象中面临链接器错误。
答案 0 :(得分:0)
这是我对一个使用 PJSIP 的项目的笔记,应该涵盖设置新 Xcode 项目的所有内容:
- Download from https://www.pjsip.org/download.htm
- Info:
https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone
https://onmyway133.com/posts/learning-voip-rtp-and-sip-aka-awesome-pjsip/
- Create ./pjproject-2.10/pjlib/include/pj/config_site.h:
#define PJ_CONFIG_IPHONE 1
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_VID_TOOLBOX_CODEC 1
#define PJ_HAS_SSL_SOCK 1
#define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_APPLE
#include <pj/config_site_sample.h>
- Create ./pjproject-2.10/user.mak:
export LDFLAGS += -framework Network -framework Security -framework VideoToolbox
- In ./pjproject-2.10 run:
$ export MIN_IOS="-miphoneos-version-min=13.0"
$ ./configure-iphone
$ make dep && make clean && make
- Add Network, Security, and VideoToolbox (for H264) iOS frameworks to Xcode project.
- Create <your app name>-Bridging-Header.h and mark it as Objective-C Bridging Header in Build Settings:
#import "pjsua.h"
...
- Add PJ_AUTOCONF to Build Settings > Preprocessor Macros
- Add/Drag the .a files from the following directories to General > Frameworks, Libraries, and Embedded Content:
./pjproject-2.10/pjlib/lib/
./pjproject-2.10/pjlib-util/lib/
./pjproject-2.10/pjmedia/lib/
./pjproject-2.10/pjnath/lib/
./pjproject-2.10/pjsip/lib/
- Add the following directories to Build Settings > Header Search Paths (use relative path from app's main directory):
./pjproject-2.10/pjlib/include/
./pjproject-2.10/pjlib-util/include/
./pjproject-2.10/pjmedia/include/
./pjproject-2.10/pjnath/include/
./pjproject-2.10/pjsip/include/