I’m trying to integrate linphone-sdk-Mac from https://download.linphone.org/releases/macosx/sdk/ to my objective c app. Basically what I’m doing is extracting zip file and import framework files to my project and then change all frameworks to “embed and sign” and then compile. Program runs fine until I try to create the core, even using “ linphone_factory_create_core_with_config_3” or “ linphone_factory_create_core_3”, they all crash with the same error, that is “could not load grammar vcard_grammar because the file could not be located”. Already tried to put grammar files in several places of the project, on different versions, including last one, but with no luck. Anyone know anyway to solve this?
Sample code:
LinphoneFactory *factory = linphone_factory_get();
NSString *linphonecfg = [LinphoneManager bundleFile:@"linphonerc"];
NSString *fileStr = [NSString stringWithContentsOfFile:linphonecfg encoding:NSUTF8StringEncoding error:nil];
configDb = linphone_config_new_from_buffer(fileStr.UTF8String);
theLinphoneCore = linphone_factory_create_core_with_config_3(factory, configDb, NULL);
Already tried to compile linphone-desktop but that is failing in random places every time I try to compile it, so could not solve that way.
Thanks
So after a lot of tinkering with the SDK, I've figured out to fix the vCard issue and compile properly without it on macOS with Swift/Objective-C (for arm64 and x86_x64).
Install the following dependencies with homebrew:
brew install pkg-config cmake doxygen nasm yasm
Install pip3/python3 (if you haven't already) and it's dependencies:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install pystache
pip3 install six
Clone the latest Linphone SDK and it's dependencies recursively
git clone --recursive https://gitlab.linphone.org/BC/public/linphone-sdk
Make and set the build directory (-DENABLE_VCARD=OFF
is the key here):
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_VCARD=OFF ..
cmake --build .
(if the build succeeded, hopefully)
linphone-sdk/desktop
folderFrameworks
and share
Frameworks
and share
folder into your Xcode project with the following options checked: LinphoneWrapper.swift
in the share/linphonesw
folder:#import "linphone/factory.h"
#import "linphone/types.h"
#import "linphone/core.h"
#import "linphone/call.h"
#import "linphone/tunnel.h"
#import "linphone/wrapper_utils.h"
#import "linphone/core_utils.h"
#import "linphone/vcard.h"
#import "belle-sip/object.h"
#import "bctoolbox/list.h"
#import "mediastreamer2/msfactory.h"
In the Frameworks, Libraries, and Embedded Content
section of your apps target, every framework should be "Embed & Sign".
Try compiling and accessing Core
, Factory
, etc... in a Swift file and it should work, if it doesn't, comment below and I'll try to help you out!