How to use liblinphone SDK by Cocoapods

Last modified by jehan monnier on 2019/04/03 16:11

Introduction

As of today, integrating liblinphone sdk into a third party application is done by either compiling an sdk  from the source or using a pre-built SDK from: http://www.linphone.org/technical-corner/liblinphone/downloads . To continue to make IOS and macOS developer live easier, we now provide a Cocoapods based integration process. Cocoapods  is a "dependency manager for Swift and Objective-C" which is now a de-facto standard in the Apple developer world. With Cocoapods, integrating liblinphone to an Xcode based application can be achieved like any "Pods"  without any liblinphone's specific procedures.   

Example to use linphone SDK in an Objective-C Xcode project

For example, the name of this project is "Myproject"

open Myproject/, use commands:

pod init

You will get Podfile, change the context. You must add your Cocoapods repo in it. For example:

# Uncomment the next line to define a global platform for your project

##For macosx
# platform :osx, '10.9'
#source "https://gitlab.linphone.org/BC/public/podspec-macos.git"

#For iOS
platform :ios, '9.0'
source "https://gitlab.linphone.org/BC/public/podspec.git"

target 'Myproject' do
  use_frameworks!

  # Pods for Myproject
  pod 'linphone-sdk' , '~> 4.1-339-gbd1ad41'
end

 Sometimes you may need to update the liblinphone version, you can do 

pod repo update
pod install

Example to use liblinphone SDK in a Swift Xcode project

First, do the same things as the section: Example to use liblinphone SDK in an Objective-C Xcode project.

Create bridging header file

This step is for enable using c headers in a swift project, because liblinphone SDK is in C.

Open Myproject/, create a bridging header file "Myproject-bridging-header.h", you can add the c headers that you want to use, like:

#import "linphone/linphonecore.h"

Configure Xcode

Open Myproject.xcworkspace, not Myproject.xcodeproj, 

in Build Settings, set "Myproject-bridging-header.h" to "Objective-C Bridging Header".

Tags:
Created by Danmei Chen on 2018/05/31 16:56