在 IOS 的设备中构建应用程序时 Twilio 崩溃 [英] Twilio crash while building the app in device in IOS

查看:28
本文介绍了在 IOS 的设备中构建应用程序时 Twilio 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过可可豆荚添加了 Twilio SDK 和 libJingleConnection.

像 libssl.a、libcryto.a 这样的 Twilio 库与像 libwebrtc.a 这样的 Libjingle_Connection 库发生冲突,所以 twilio 崩溃了.. 没有集成 libjingle_connection.

Twilio 集成工作正常.!

类似于下面的问题

了解如何生成功能令牌.

第 8 步:创建一个 makeCall.php 文件并在您的 twiML 应用程序 (Twilio acc) 中设置它的链接以进行呼叫.

第 9 步:从 xcode 向客户端注册.

在您的 basicPhone.h 文件中

#define BPDefaultClientName @"abc"#define BPCapabilityTokenKeyIncomingClient @"abc"

并且在您的 basicPhone.m 方法中,您必须具有该功能

getCapabilityTokenWithParameters

使用您的 capabilitiesToken url 更改那里的 urlString .

如果您希望传入和传出,那么您的功能令牌网址应如下所示:

https://abc.herokuapp.com/token?allowOutgoing=true&client=abc

第 10 步:在您的 viewcontroller.h 中登录 twilio

创建一个basicPhone对象

@class BasicPhone;@接口视图控制器:UIViewController{基本电话* _电话;}@property (nonatomic,retain) BasicPhone* 电话;

在 ViewController.m 中

@synthesize phone=_phone;- (void)viewDidLoad {[超级viewDidLoad];AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;BasicPhone* basicPhone = delegate.phone;【基本手机登录】;}

拨打电话:

NSDictionary* dictParams = [NSDictionary dictionaryWithObjectsAndKeys:@"xyz", @"To", nil];NSLog(@"%@",dictParams);AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;BasicPhone* basicPhone = delegate.phone;[basicPhone connectWithParams:dictParams];

这就是我所做的,它的工作没有任何问题.

如果有帮助,我会感觉很好.

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...!

解决方案

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 .

这篇关于在 IOS 的设备中构建应用程序时 Twilio 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆