收到测试飞行中的通知但无法正常工作
Notification in testflight received but not working
我正在使用 testflight 测试我的应用程序,并使用 Firebase 消息发送通知。
发送通知后,具有指定令牌的用户收到了通知,但通过点击通知标记,应用中的相关页面不会出现。像didReceiveRemoteNotification
不叫。
我之前在手机上测试过通知,运行 应用直接在手机上测试,效果很好。
我将调试配置文件更改为分发并且在 Firebase 中将 APNs 身份验证密钥方法更改为 APNs 证书,但它还不起作用。
这是 AppDelegate。
我认为你没有在应用程序委托中检查授权 didFinishLaunchingWithOptions
。
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions) { (accepted, error) in
if !accepted{
CLog.i("Notification not accepted!")
}
}
UIApplication.shared.registerForRemoteNotifications()
我正在使用 testflight 测试我的应用程序,并使用 Firebase 消息发送通知。
发送通知后,具有指定令牌的用户收到了通知,但通过点击通知标记,应用中的相关页面不会出现。像didReceiveRemoteNotification
不叫。
我之前在手机上测试过通知,运行 应用直接在手机上测试,效果很好。
我将调试配置文件更改为分发并且在 Firebase 中将 APNs 身份验证密钥方法更改为 APNs 证书,但它还不起作用。
这是 AppDelegate。
我认为你没有在应用程序委托中检查授权 didFinishLaunchingWithOptions
。
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions) { (accepted, error) in
if !accepted{
CLog.i("Notification not accepted!")
}
}
UIApplication.shared.registerForRemoteNotifications()