Reputation: 5369
I have added Twilio SDK and libJingleConnection through cocoa pods.
Twilio libraries like libssl.a , libcryto.a is getting conflicts with Libjingle_Connection libraries like libwebrtc.a so twilio is crashing.. Without integrating libjingle_connection.
Twilio integration is working fine.!
It is similar to below problem
When using Twilio iOS sdk and building Cordova app openssl crashes
But I need to keep both libjingle_connection and twilio in my project.
When I build the app in device. My app is crashing as below..
My other linker flags are -ObjC and $(inherited)
I am not able to find the cause of crash..
Please suggest any solutions to fix the error..
Thanks in Advance...!
Upvotes: 1
Views: 557
Reputation: 1611
remove -objC
from other linker flag. It worked for me
Upvotes: 0
Reputation: 284
Hiii ,
Please Follow the steps to integrate twilio in app .
step 1 : import required Frameworks
step 2: Copy the Headers and Library Folders into Your Project .
Step 3: Add other Linker flags ( not only -ObjC but -lTwilioClient,-lcrypto,-lssl)
step 4: Add Header and Library search paths
Path of header folder you copied : $(SRCROOT)/Headers
Path of Library folder you copied : $(SRCROOT)/Libraries
step 5: Add prefix header file
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
Make Precompile Prefix header to yes in build settings , and path of .pch file .
After This steps your project should compile and build , you can run it but , to use twilio you need to generate capabilities token .
step 6 :From Twilio's BasicPhone example copy basicPhone.h and basicPhone.m file in your project .
then in Appdelegate create an global object that we can access through out in project .
in appdelegate.h
@class BasicPhone;
@interface AppDelegate : UIResponder <UIApplicationDelegate>{
BasicPhone *_phone;
}
@property (strong, nonatomic)BasicPhone *phone;
synthesize it in appDelegate.m file
@synthesize phone = _phone;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
/* iOS 8.0 later */
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|
UIUserNotificationTypeBadge|
UIUserNotificationTypeSound
categories:nil]];
}
self.phone = [[BasicPhone alloc] init];
}
step 7: capabilities Token :
Check this Link for how to generate capabilities token .
step 8 : create a makeCall.php file and in your twiML app (Twilio acc) set it's link for making calls .
step 9 : from xcode register with client .
In your basicPhone.h file
#define BPDefaultClientName @"abc"
#define BPCapabilityTokenKeyIncomingClient @"abc"
and in you basicPhone.m method you must have the function
getCapabilityTokenWithParameters
Change the urlString there with your capabilitiesToken url .
If you want both incoming and out going then your capabilities token url should be like this :
https://abc.herokuapp.com/token?allowOutgoing=true&client=abc
step 10 : in your viewcontroller.h login into twilio
Create an object of basicPhone
@class BasicPhone;
@interface ViewController : UIViewController{
BasicPhone* _phone;
}
@property (nonatomic,retain) BasicPhone* phone;
in ViewController.m
@synthesize phone=_phone;
- (void)viewDidLoad {
[super viewDidLoad];
AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
BasicPhone* basicPhone = delegate.phone;
[basicPhone login];
}
To make outGoing Calls :
NSDictionary* dictParams = [NSDictionary dictionaryWithObjectsAndKeys:@"xyz", @"To", nil];
NSLog(@"%@",dictParams);
AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
BasicPhone* basicPhone = delegate.phone;
[basicPhone connectWithParams:dictParams];
This is how I did and Its working without any issue .
I will feel good If it helps .
Upvotes: 2