gpt4 book ai didi

ios - VoIP 铃声不起作用

转载 作者:行者123 更新时间:2023-11-30 12:46:20 27 4
gpt4 key购买 nike

我正在使用 iOS 版本 9 和 swift。我可以在应用程序处于事件状态时接听电话,但当应用程序关闭或在后台时,我遇到了一个问题,它只收到通知,而不是完整的铃声(我正在使用 SinchService),但它不起作用。我已添加 VoIP 证书并且它是有效的

代码

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
sinch?.push().application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
sinch?.push().application(application, didReceiveRemoteNotification: userInfo)
}


func startManager() {
let config = SinchService.config(withApplicationKey: VoiceManager.SinchKey, applicationSecret: VoiceManager.SinchSecret, environmentHost: VoiceManager.SinchHost).pushNotifications(with: SINAPSEnvironment.development)
let sinch = SinchService.service(with: config)
sinch?.delegate = self
sinch?.callClient().delegate = self

let push = Sinch.managedPush(with: SINAPSEnvironment.development)
push?.delegate = self
push?.setDesiredPushTypeAutomatically()

let appDelegate: AppDelegate = (UIApplication.shared.delegate as! AppDelegate)
appDelegate.sinch = sinch
appDelegate.push = push
}

//标记:-SINCallClientDelegate

func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) {
//show calling view
let controller = UIViewController.currentViewController()
VoiceCallingViewController.show(call: call, viewController: controller)
}


func client(_ client: SINCallClient!, localNotificationForIncomingCall call: SINCall!) -> SINLocalNotification! {
let notification = SINLocalNotification()
notification.alertAction! = LanguageManager.localizedString(key: "answer")
notification.alertBody = "\(LanguageManager.localizedString(key: "incomming-call")) \(call.remoteUserId)"
return notification
}

最佳答案

您没有在本地通知方法中设置任何声音。为通知添加声音

关于ios - VoIP 铃声不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41591626/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com