热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

接受呼叫后使用openTok(CallKit)-UsingopenTokafteracceptaCall(CallKit)

Iamworkingonaprojectwhichrequiresopentokandcallkitfornotifyingusers.However,theappli

I am working on a project which requires opentok and callkit for notifying users. However, the application keeps crashing when openTok tries to connect to a session. IDK what is going on right now. Here is my work flow and codes:

我正在开发一个需要opentok和callkit来通知用户的项目。但是,当openTok尝试连接到会话时,应用程序会一直崩溃。 IDK现在正在发生什么。这是我的工作流程和代码:

Push notification about available opentok session -> start incoming call -> user accept the call -> start the opentok storyboard -> do some backend stuff -> connect to a session !!!! THIS IS WHEN IT CRASHES.

推送关于可用的opentok会话的通知 - >开始传入呼叫 - >用户接受呼叫 - >启动opentok故事板 - >做一些后端的东西 - >连接到会话!!!!这就是它崩溃的时候。

ERROR: Thread 1: EXC_BAD_ACCESS (code=2, address=0x1968a0ad8) enter image description here

错误:线程1:EXC_BAD_ACCESS(代码= 2,地址= 0x1968a0ad8)

Besides, I would like to ask for advice about receive notification. Instead of showing the notification on the screen. I would like to start the call, using callkit, like whatsapp or fb messenger. Please give me a hint about this also. Right now, I can only start the call when the app is in foreground when push notification is sent.

此外,我想询问有关接收通知的建议。而不是在屏幕上显示通知。我想使用callkit开始调用,比如whatsapp或fb messenger。请给我一个暗示。现在,我只能在发送推送通知时应用程序处于前台时启动呼叫。

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    // If you are receiving a notification message while your app is in the background,
    // this callback will not be fired till the user taps on the notification launching the application.
    // TODO: Handle data of notification
    // With swizzling disabled you must let Messaging know about the message, for Analytics
    // Messaging.messaging().appDidReceiveMessage(userInfo)
    // Print message ID.
    if let messageID = userInfo[gcmMessageIDKey] {
        print("Message ID: \(messageID)")
    }

    // Print full message.
    print(userInfo)

    let aps = userInfo["aps"] as! [String: AnyObject]
    // 1
    if aps["content-available"] as? Int == 1 {

        let uuid = UUID(uuidString: MyVariables.uuid)
        AppDelegate.shared.displayIncomingCall(uuid: uuid!, handle: "Sanoste", hasVideo: false) { _ in
        }
    }else  {
        return
    }

    completionHandler(UIBackgroundFetchResult.newData)
}


func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {

    action.fulfill()
    AppDelegate.shared.openTok()
}


func openTok() {

    let mainStoryboard = UIStoryboard(name: "callView", bundle: nil)
    let vc = mainStoryboard.instantiateViewController(withIdentifier: "callViewController") as! callViewController

    vc.view.frame = UIScreen.main.bounds
    UIView.transition(with: self.window!, duration: 0.5, options: .transitionCrossDissolve, animations: {
        self.window!.rootViewCOntroller= vc
    }, completion: nil)

}

// Join a session from MBE
func joinSession() {

    var error: OTError?

    pSession = OTSession(apiKey: openTokSessionKey.pApiKey, sessionId: openTokSessionKey.pSessionId, delegate: self as OTSessionDelegate)
    pSession?.connect(withToken: openTokSessionKey.pToken, error: &error)
    if error != nil {
        print(error!)
    }

    sSession = OTSession(apiKey: openTokSessionKey.sApiKey, sessionId: openTokSessionKey.sSessionId, delegate: self as OTSessionDelegate)
    sSession?.connect(withToken: openTokSessionKey.sToken, error: &error)
    if error != nil {
        print(error!)
    }
}

Anyone helps please ?

有人帮忙吗?

1 个解决方案

#1


1  

This crash is a kind of warning. If you disable "Main Thread Sanitizer" in your project settings in Xcode 9 and rebuild your project, can fix the issue.

这次崩溃是一种警告。如果在Xcode 9的项目设置中禁用“主线程清理器”并重建项目,则可以解决问题。


推荐阅读
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • 本文介绍了Python爬虫技术基础篇面向对象高级编程(中)中的多重继承概念。通过继承,子类可以扩展父类的功能。文章以动物类层次的设计为例,讨论了按照不同分类方式设计类层次的复杂性和多重继承的优势。最后给出了哺乳动物和鸟类的设计示例,以及能跑、能飞、宠物类和非宠物类的增加对类数量的影响。 ... [详细]
  • 本文介绍了一个适用于PHP应用快速接入TRX和TRC20数字资产的开发包,该开发包支持使用自有Tron区块链节点的应用场景,也支持基于Tron官方公共API服务的轻量级部署场景。提供的功能包括生成地址、验证地址、查询余额、交易转账、查询最新区块和查询交易信息等。详细信息可参考tron-php的Github地址:https://github.com/Fenguoz/tron-php。 ... [详细]
  • Iamtryingtocreateanarrayofstructinstanceslikethis:我试图创建一个这样的struct实例数组:letinstallers: ... [详细]
  • 图解 Google V8 # 19 :异步编程(二):V8 是如何实现 async/await 的?
    说明图解GoogleV8学习笔记前端异步编程的方案史1、什么是回调地狱?如果在代码中过多地使用异步回调函数,会将整个代码逻辑打乱,从 ... [详细]
  • PriorityQueue源码分析
     publicbooleanhasNext(){returncursor<size||(forgetMeNot!null&am ... [详细]
  • 796.[APIO2012]派遣在一个忍者的帮派里,一些忍者们被选中派遣给顾客,然后依据自己的工作获取报偿。在这个帮派里,有一名忍者被称之为Master。 ... [详细]
  • CryptSIPRetrieveSubjectGuid
    简介CryptSIPRetrieveSubjectGuid根据文件类型检索SubjectGUID,用于CryptSIPLoad。提示如果检索失败可以使用通用的CRYPT_SUBJT ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • React项目中运用React技巧解决实际问题的总结
    本文总结了在React项目中如何运用React技巧解决一些实际问题,包括取消请求和页面卸载的关联,利用useEffect和AbortController等技术实现请求的取消。文章中的代码是简化后的例子,但思想是相通的。 ... [详细]
  • 本文是一篇翻译文章,介绍了async/await的用法和特点。async关键字被放置在函数前面,意味着该函数总是返回一个promise。文章还提到了可以显式返回一个promise的方法。该特性使得async/await更易于理解和使用。本文还提到了一些可能的错误,并希望读者能够指正。 ... [详细]
  • 一、路由首先需要配置路由,就是点击good组件进入goodDetail组件配置路由如下{path:goodDetail,component:goodDetail}同时在good组件中写入如下点击事件,路由中加入 ... [详细]
  • Imdevelopinganappwhichneedstogetmusicfilebystreamingforplayinglive.我正在开发一个应用程序,需要通过流 ... [详细]
  • 点击上方[全栈开发者社区]→右上角[]→[设为星标⭐]前言年前准备换工作,总结了一波面试最频繁的面试问题跟大家交流。此文章是关于浏览器的常见问题, ... [详细]
  • 1、锁机制当前MySQL支持 ISAM, MyISAM,MEMORY(HEAP) 类型表的表级锁,BDB 表支持页级锁,InnoDB 表支持行级锁。很多时候,可以通过经验来 ... [详细]
author-avatar
至上励合_安儿_466
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有