每个推送通知横幅在 iOS9 上显示两次 [英] Every Push Notification Banner is shown twice on iOS9

查看:37
本文介绍了每个推送通知横幅在 iOS9 上显示两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个小时后,我们的 iOS 应用出现了一个奇怪的问题:在 iOS 主屏幕上收到的每个推送通知都会触发/显示相同的通知横幅两次,它们之间有 2 秒的延迟.

Since a few hours we have a strange issue in our iOS app: every push notification received on the home screen of iOS will trigger/show the same notification banner twice with a 2 sec delay between them.

  • 它只发生在装有 iOS 9.x 的设备上.在 iOS 8.x 设备上,一切仍按预期工作.
  • 如果我在 -[AppDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:] 中设置了一个断点,它只会为每个推送通知调用一次.

此外,我们最近没有对后端进行任何更改(至少是微弱的),并且对于已经发布的客户端也会发生这种情况,我们 100% 确定我们之前没有发现该问题.

Also we did no change in the backend recently (at least a weak) and it also happens for client which are already released and we are 100% certain we did not see the issue before.

然而,我们确实更改了当前开发应用程序的 Xcode 功能,并且必须生成新的配置文件作为标记为无效"的旧配置文件.

We did however change the capability in Xcode of the current development app and had to generate new provisioning profiles as the old ones where tagged as "Invalid".

所以对我们来说,这似乎是 Apple 方面的一个问题.还有什么建议可以尝试/检查或做什么?

So for us it looks like an issue on Apple sides. Any suggestions what more to try/check or what to do?

推荐答案

看来我和这个家伙有完全相同的问题 有:我调用了 [registerUserNotificationSettings:] 两次.

It seems like I had exactly the same issue as this dude had: I called [registerUserNotificationSettings:] twice.

请注意,如果您调用该方法一次或两次,可能并不像您想象的那么明显:

Be aware that it might not be as obvious as you think to see if you called the method once or twice:

我在特定的 UIViewController 中故意调用了一次.不幸的是,我每次也在 didFinishLauchingWithOptions: 中调用它.不要因为您只看到一次对话框而上当.

I called it once on purpose in specific UIViewController. Unfortunately I also called it each time in didFinishLauchingWithOptions:. Don't let yourself be fooled because you see the dialog only once.

如果您想确保在 -[AppDelegate application:didRegisterUserNotificationSettings:] 中添加日志输出.在我的例子中,在我在权限对话框上点击 OK 后,回调被调用了两次.

If you want to be sure add a logging output in -[AppDelegate application:didRegisterUserNotificationSettings:]. In my case the callback was called twice after I hit OK on the permission dialog.

自从我删除了 didFinishLauchingWithOptions: 中的 misplace 调用后,我再也没有看到双重通知.

Since I remove the misplace call in didFinishLauchingWithOptions: I did not see anymore double notifications.

这篇关于每个推送通知横幅在 iOS9 上显示两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆