我正在搜索关于VoIP推送通知的推送通知的信息.我有点不清楚:
1)如果用户没有打开应用程序,那么他接到一个电话.从通知中启动应用程序是否有意义?
2)应用程序如何等待特定事件?例如,我的设备如何知道他接到某人的电话?
3)我使用来自https://github.com/Hitman666/ios-voip-push的Appdelegate文件,但在我的情况下它不起作用(很多错误),这里是我得到的错误的预览.
谢谢
我们的申请已经在APNS注册.由于我们要实施PushKit,我们也创建了VOIP证书.真的有必要吗?我们不能只使用APNS证书进行VOIP推送吗?
由于现在有两个证书,我必须维护两个令牌.一个用于发送正常推送,另一个用于发送VOIP推送.
我们不能简单地为一个目的使用一个令牌/证书吗?
查看过去关于此的问题,但这些问题的答案已经应用于我的项目,但是没有调用pushRegistry()委托方法.
首先是这里的代码:
import UIKit
import PushKit
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate{
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let notificationSettings = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
UNUserNotificationCenter.current().delegate = self
UIApplication.shared.registerForRemoteNotifications()
let voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
voipRegistry.delegate = self;
return true
}
...
}
extension AppDelegate: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
NSLog("voip token: \(pushCredentials.token)")
}
Run Code Online (Sandbox Code Playgroud)
已启用以下应用程序功能: - 推送通知 …
我已经使用 tokbox 进行视频通话,并按照此处的步骤实现了 VoIP 推送通知。
当脚本在后端运行时,它显示推送已成功发送,但应用程序端未收到 VoIP 推送。
当应用程序成功接收 APNs 通知时。
任何人都可以为此提出解决方案吗?