gpt4 book ai didi

ios - 如何在 Swift 项目中集成 PjSip?

转载 作者:行者123 更新时间:2023-12-04 13:03:37 25 4
gpt4 key购买 nike

enter image description here我想将 PJSIP 集成到我的项目中,我正在按照给站点 ( https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone ) 的步骤进行操作。我能够按照他们所说的去做一个项目。但我知道我想集成到我的 swift 项目中。谁能指导我,如何在我的代码中集成 PJSIP 库和其他代码。现在,我在我的 swift 对象中面临链接器错误。

最佳答案

这是我对使用 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/

关于ios - 如何在 Swift 项目中集成 PjSip?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45281980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com