为什么当应用程序为前台时显示推送通知? (iOS10/iPhone 7) [英] Why push notification is shown when app is foreground? (iOS10 / iPhone 7)

查看:150
本文介绍了为什么当应用程序为前台时显示推送通知? (iOS10/iPhone 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的经验很奇怪. 当应用程序为前台时,为什么会显示推送通知(以本机标题显示)? 仅在iPhone 7(iOS10.1.1)上复制.

I'm having weird experience. Why push notification is shown (in native banner) when app is foreground? It's only reproduced on iPhone 7 (iOS10.1.1).

我在其他具有相同应用程序,相同iOS版本的iPhone(如iPhone 5和iPhone 6s)上进行了测试. 当应用正常显示在前台时,不会显示该消息.

I tested on the other iPhones like a iPhone 5 and iPhone 6s with same app, same iOS version. It's not shown when app is in foreground as normal.

推幅仅出现在iPhone 7上.

Push banner appears only on iPhone 7.

这正常吗?

我的应用是由Xamarin.forms创建的. (目前,Xamarin将c#代码转换为目标C,因此基本上是目标c)

My app is created by Xamarin.forms. (For now, Xamarin convert c# code to objective C, so it's basically objective c)

谢谢.

推荐答案

如果应用程序已升级到iOS10,并且其应用程序的开发人员已使用

If an application is upgraded to iOS10, and developers of their app have used the UserNotifications framework.Then there are functions by which notification can be displayed as a native banner when app is in foreground.

UNNotificationPresentationOptions 标志可让您将UNNotificationPresentationOptionAlert指定为使用通知提供的文本显示警报.

The UNNotificationPresentationOptions flags allow you to specify UNNotificationPresentationOptionAlert to display an alert using the text provided by the notification.

如果您使用iOS10,并且应用程序与UserNotifications框架兼容,则效果相同.

It effect will same if you are using iOS10 , and app is compatible with UserNotifications framework.

正如您提到的,您已经用其他具有相同版本的设备测试了该应用程序,则可能是这些设备上未安装其应用程序的最新版本.

As you mentioned, you have tested the app with Other device with same version, Then might be their app's latest version is not installed on those devices.

它不仅基于iPhone7.当iOS10是 安装在您的设备和应用程序中的应用程序正在使用UserNotifications 处理通知的框架.

It is not based on iPhone7 only. That will work when iOS10 is installed in your device and application is using UserNotifications framework for handling the notification.

这篇关于为什么当应用程序为前台时显示推送通知? (iOS10/iPhone 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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