How to use liblinphone SDK by Cocoapods

Last modified by Danmei Chen on 2018/06/05 09:10

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 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 liblinphone SDK in an Objective-C Xcode project

For example, the name of this framework 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
platform :ios, '9.0'
source "https://gitlab.linphone.org/BC/public/Specs.git"

target 'Myproject' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  #use_frameworks!

  # Pods for Myproject
  pod 'liblinphone'
  target 'MyprojectTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Then:

pod install

 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