【问题标题】:Notification in testflight received but not working已收到测试飞行中的通知但无法正常工作
【发布时间】:2019-09-22 09:13:24
【问题描述】:

我正在使用 testflight 对我的应用进行 beta 测试,并使用 Firebase 消息发送通知。

发送通知时,具有指定令牌的用户会收到通知,但通过点击通知徽章,应用程序中的相关页面不会出现。就像didReceiveRemoteNotification 没有被调用。

我之前在手机上测试过通知,直接在手机上运行应用程序,效果很好。

我将调试配置文件更改为分发并且在 Firebase 中将 APNs 身份验证密钥方法更改为 APNs 证书,但它还不起作用。

这是 AppDelegate。

【问题讨论】:

标签: swift firebase-cloud-messaging apple-push-notifications


【解决方案1】:

我认为您没有在应用委托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()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-24
    • 2016-06-19
    • 2019-11-03
    • 2016-11-27
    相关资源
    最近更新 更多