简体   繁体   English

将Linphone应用程序集成到我的iOS应用程序中

[英]Integrate Linphone app to my iOS app

There are about 20 questions on Linphone ios build in StackOverflow. 在StackOverflow中构建Linphone ios大约有20个问题。 A couple of them ask about integrating Linphone to an existing xcode project. 其中一些人询问将Linphone集成到现有的xcode项目中。 I have followed them all. 我跟着他们了。 I am able to build and run the Linphone project successfully. 我能够成功构建和运行Linphone项目。

However, to integrate to my existing project, I have included: 但是,要整合到我现有的项目中,我已经包括:

  • linphone-sdk/apple-darwin/include and linphone-sdk/apple-darwin/lib to my project. linphone-sdk / apple-darwin / includelinphone-sdk / apple-darwin / lib到我的项目。
  • the following lines to Xcode project->Build Settings->Search Path/Header Search Path : submodules/linphone/coreapi submodules/linphone/mediastreamer2/include submodules/linphone/mediastreamer2/include submodules/linphone/oRTP/include submodules/externals/gsm/ submodules/externals/osip/include submodules/externals/exosip/include submodules/externals/speex/include Classes/Utils/NinePatch/ Classes/Utils/XMLRPC/ 以下几行到Xcode项目 - >构建设置 - >搜索路径/标题搜索路径 :子模块/ linphone / coreapi子模块/ linphone / mediastreamer2 / include子模块/ linphone / mediastreamer2 / include子模块/ linphone / oRTP / include子模块/ externals / gsm / submodules / externals / osip / include子模块/ externals / exosip / include子模块/ externals / speex / include Classes / Utils / NinePatch / Classes / Utils / XMLRPC /
  • marking all .a with target membership to my current target 目标成员资格的所有.a标记为当前目标

What else should i do to get Linphone working in my project? 我还应该做些什么才能让Linphone在我的项目中工作? Or should I make a static library of Linphone ? 或者我应该制作Linphone的静态库 If Yes, what things should i take care about? 如果是的话,我应该注意什么?

To be able to build and run Linphone on a Swift project I had to the following steps: 为了能够在Swift项目上构建和运行Linphone,我必须执行以下步骤:

  1. Downlaod the latest SDK (with wget) from: http://www.linphone.org/snapshots/ios/liblinphone-iphone-sdk-latest.zip http://www.linphone.org/snapshots/ios/liblinphone-iphone-sdk-latest.zip下载 最新的SDK(带wget)

  2. Copy,paste and insert in the project: 复制,粘贴和插入项目:

    • liblinphone-sdk/apple-darwin/include liblinphone-SDK /苹果达尔文/包括
    • liblinphone-sdk/apple-darwin/lib liblinphone-SDK /苹果达尔文/ lib目录
    • liblinphone-sdk/apple-darwin/share/images liblinphone-SDK /苹果达尔文/股/图片
    • liblinphone-sdk/apple-darwin/share/sounds liblinphone-SDK /苹果达尔文/股/声音
  3. Create a Bridging-Header.h with: 使用以下命令创建Bridging-Header.h:

    • #import <Foundation/Foundation.h>
    • #import <UIKit/UIKit.h>
    • #import <linphone/linphonecore.h>
  4. Create a PrefixHeader.pch which import your Bridging-Header: 创建一个导入Bridging-Header的PrefixHeader.pch:

    • #import "Bridging-Header.h"
  5. Integrate The following pods: 集成以下pod:

    • pod 'xmlrpc', '~> 2.3.4'
    • pod 'Tortuga22-NinePatch', '~> 0.1.1'
  6. Configure the build Settings: 配置构建设置:

` `

GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_PREFIX_HEADER = path/to/PrefixHeader.pch
OTHER_LDFLAGS = -ObjC $(inherited)
FRAMEWORK_SEARCH_PATHS = $(inherited)
HEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/Headers/Public $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/include
LIBRARY_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/lib $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins

` `

  1. Configure the macros: 配置宏:

` `

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HAVE_OPENH264 HAVE_SILK HAVE_SSL
OTHER_SWIFT_FLAGS = $(inherited) -D HAVE_OPENH264 -D HAVE_SILK -D HAVE_SSL

` `

  1. Libraries and Framework: 图书馆和框架:

First add all the libs from the folder (and subfolders) liblinphone-sdk/apple-darwin/lib . 首先添加文件夹(和子文件夹) liblinphone-sdk/apple-darwin/lib Then be sure to add the following list: 然后一定要添加以下列表:

Pods: 荚:

  • libPods.a libPods.a

Dynamic Libs: 动态Libs:

  • libz.dylib libz.dylib
  • libiconv.dylib libiconv.dylib
  • libxml2.dylib libxml2.dylib
  • libsqlite3.dylib libsqlite3.dylib
  • libc++.dylib 的libc ++。dylib
  • libstdc++.6.dylib 的libstdc ++。6.dylib
  • libresolv.dylib libresolv.dylib

Frameworks: (sorry I'm not sure if they are all 100% needed but this is how I managed to get the lib to build) 框架:(抱歉,我不确定它们是否都是100%需要,但这是我设法让lib构建的方式)

  • AudioToolbox.framework AudioToolbox.framework
  • UIKit.framework UIKit.framework
  • QuartzCore.framework QuartzCore.framework
  • OpenGLES.framework OpenGLES.framework
  • MessageUI.framework MessageUI.framework
  • MediaPlayer.framework MediaPlayer.framework
  • CoreGraphics.framework CoreGraphics.framework
  • MobileCoreServices.framework MobileCoreServices.framework
  • AddressBookUI.framework AddressBookUI.framework
  • AddressBook.framework AddressBook.framework
  • SystemConfiguration.framework SystemConfiguration.framework
  • CFNetwork.framework CFNetwork.framework
  • AssetsLibrary.framework AssetsLibrary.framework
  • AVFoundation.framework AVFoundation.framework
  • CoreAudio.framework CoreAudio.framework
  • CoreMedia.framework CoreMedia.framework
  • CoreTelephony.framework CoreTelephony.framework
  • CoreVideo.framework CoreVideo.framework
  • Foundation.framework Foundation.framework
  • CoreLocation.framework CoreLocation.framework

How to test: 如何测试:

To verify that it was working, I integrated some sample code from the Linphone app and made some minor setups in my view controllers. 为了验证它是否正常工作,我从Linphone应用程序中集成了一些示例代码,并在我的视图控制器中进行了一些小的设置。 To do so I integrated in the project the following classes: 为此,我在项目中集成了以下类:

  • Utils.[h, m] 实用程序。[h,m]
  • LinphoneManager.[h, m] LinphoneManager。[h,m]
  • LinphoneCoreSettingsStore.[h, m] LinphoneCoreSettingsStore。[h,m]
  • FastAddressBook.[h, m] FastAddressBook。[h,m]
  • LinphoneIOSVersion.h LinphoneIOSVersion.h
  • pod 'InAppSettingsKit', '~> 2.6' pod'InAppSettingsKit','〜> 2.6'

PS: I had to update them in order to build without warnings or errors. PS:我必须更新它们才能在没有警告或错误的情况下进行构建。

I hope this will help someone one day! 我希望有一天能帮助别人!

Check with below Header Search Paths. 检查下面的标题搜索路径。 Also set Other Linker Flags -ObjC 同时设置Other Linker Flags -ObjC

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM