热门标签 | 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的项目设置中禁用“主线程清理器”并重建项目,则可以解决问题。


推荐阅读
  • 本文详细介绍了优化DB2数据库性能的多种方法,涵盖统计信息更新、缓冲池调整、日志缓冲区配置、应用程序堆大小设置、排序堆参数调整、代理程序管理、锁机制优化、活动应用程序限制、页清除程序配置、I/O服务器数量设定以及编入组提交数调整等方面。通过这些技术手段,可以显著提升数据库的运行效率和响应速度。 ... [详细]
  • 本文详细探讨了在微服务架构中,使用Feign进行远程调用时出现的请求头丢失问题,并提供了具体的解决方案。重点讨论了单线程和异步调用两种场景下的处理方法。 ... [详细]
  • 本文探讨了一个特定于 Spring 4.2.5 的问题,即在应用上下文刷新事件(ContextRefreshedEvent)触发时,带有 @Transactional 注解的 Bean 未能正确代理事务。该问题在 Spring 4.1.9 版本中正常运行,但在升级至 4.2.5 后出现异常。 ... [详细]
  • Windows环境下部署Kubernetes Dashboard指南
    本指南详细介绍了如何在Windows系统中部署Kubernetes Dashboard,包括下载最新配置文件、修改服务类型以支持NodePort访问、下载所需镜像并启动Dashboard服务等步骤。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 深入解析 Apache Shiro 安全框架架构
    本文详细介绍了 Apache Shiro,一个强大且灵活的开源安全框架。Shiro 专注于简化身份验证、授权、会话管理和加密等复杂的安全操作,使开发者能够更轻松地保护应用程序。其核心目标是提供易于使用和理解的API,同时确保高度的安全性和灵活性。 ... [详细]
  • 深入解析 Spring Security 用户认证机制
    本文将详细介绍 Spring Security 中用户登录认证的核心流程,重点分析 AbstractAuthenticationProcessingFilter 和 AuthenticationManager 的工作原理。通过理解这些组件的实现,读者可以更好地掌握 Spring Security 的认证机制。 ... [详细]
  • 探讨 HDU 1536 题目,即 S-Nim 游戏的博弈策略。通过 SG 函数分析游戏胜负的关键,并介绍如何编程实现解决方案。 ... [详细]
  • 本文深入探讨了MySQL中常见的面试问题,包括事务隔离级别、存储引擎选择、索引结构及优化等关键知识点。通过详细解析,帮助读者在面对BAT等大厂面试时更加从容。 ... [详细]
  • Django Token 认证详解与 HTTP 401、403 状态码的区别
    本文详细介绍了如何在 Django 中配置和使用 Token 认证,并解释了 HTTP 401 和 HTTP 403 状态码的区别。通过具体的代码示例,帮助开发者理解认证机制及权限控制。 ... [详细]
  • KVO(键值观察)是iOS开发中的一项重要技术,它允许一个对象监视另一个对象的属性变化,并在这些属性发生变化时得到通知。KVO特别适用于需要响应模型数据变化的场景。 ... [详细]
  • 本文探讨了几款Lua调试工具的特点和适用场景,特别是针对Lua 5.1和5.2版本。其中,Visual Studio插件因其高效性和强大的功能成为调试Lua 5.1的最佳选择。 ... [详细]
  • GNU GRUB(简称GRUB)是一个来自GNU项目的支持多启动的引导加载程序。它允许用户在同一台计算机上安装多个操作系统,并在启动时选择希望启动的系统。 ... [详细]
  • 本文探讨了在使用Java Native Interface (JNI)时,JNI二进制文件是否使用自己的内存空间,还是共享JVM分配的内存。同时,文章还详细分析了JVM如何在指定最大堆大小的情况下管理和分配内存。 ... [详细]
  • IntelliJ IDEA 配置详解及优化建议
    本文详细解析了 IntelliJ IDEA 的 JVM 参数配置,包括如何优化多核 CPU 性能、调整堆内存大小以及选择合适的垃圾回收器,以提升开发效率和系统响应速度。 ... [详细]
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社区 版权所有