【发布时间】:2020-09-19 17:58:04
【问题描述】:
我们有一个 Cordova 应用程序,它使用 WebRTC 进行视频聊天。
我们正在使用这个插件来实现 VOIP 推送通知
https://github.com/mattkhaw/cordova-plugin-callkit.
除此之外,我们还使用 AWS SNS 为我们处理 VOIP 推送。
流程是如何工作的?
IOS Device Calee (User A)
1. When device opens the app, it registers on Apple servers and
receives a VOIP Device Token
2. We call Amazon SNS to save the token and get the endpointARN for that token
3. We save the token in the database along with the user ID and endpointARN
from AWS
Caller Side (User B)
1. User B wants to call User A
2. User B clicks the call button
3. A request it send to the server, which checks if a token exists for User A
in the database.
4. If it exists, we call AWS SNS endpointARN so it will
send a VOIP push to User A
当应用程序打开或应用程序处于后台时,所有这些都可以正常工作。
当应用程序被终止(终止)时会出现问题。
当应用程序被终止时,应用程序崩溃,这是我们收到的关于 https://gist.github.com/AleksandarTokarev/74068feadd728a4bd1c672a024482af4 的日志。
我对日志细节做了一些研究,似乎原因写在
https://developer.apple.com/forums/thread/124517。
The exception code "0xbaadca11" indicates that your app was killled for failing to report a CallKit
call in response to a PushKit notificaiton. That should have been clear in the crash log,
but this particular requirement is implemented through multiple code paths and it looks like this
one isn't as clear as the others. For more details on the new requirement, take a look at:
https://developer.apple.com/videos/play/wwdc2019/707/
知道为什么会这样吗?该插件在应用程序运行或后台运行时正常工作。
我正在使用以下负载调用 AWS SNS
let voip_protocol_value = `{"aps" : { "alert": "New Incoming Call" },
"data" : { "Caller": { "Username" : "${caller}", "ConnectionId": "${Random.id()}"}}}`
let payload = {}
payload[`APNS_VOIP`] = voip_protocol_value
let params = {
'Message': JSON.stringify(payload),
'MessageAttributes': {
'AWS.SNS.MOBILE.APNS.PRIORITY': {
'DataType': 'String',
'StringValue': '10'
},
'AWS.SNS.MOBILE.APNS.PUSH_TYPE': {
'DataType': 'String',
'StringValue': 'voip'
},
},
'MessageStructure': 'json',
'TargetArn': user.endpointArn
}
【问题讨论】:
标签: cordova apple-push-notifications cordova-plugins voip ios13