根据我的理解,当应用程序正在运行或在前台并收到推送通知时,应用程序不应显示任何警报,但应用程序委托将调用didReceiveRemoteNotification
委托方法,我应该在该回调中处理推送通知。
推送通知应仅在应用程序处于后台时显示警报/横幅。
但是,当应用程序正在运行或在前台运行时(并非始终如此),我们的应用程序会收到带有“确定”按钮的推送通知警报。我想知道这是否是 iOS 7 中的新功能(我从未听说过)或者是因为我正在使用UrbanAirship
用于我们的 iOS 应用程序的推送通知,使用alias
用户的。该应用程序将在运行时显示推送警报并运行回调didReceiveRemoteNotification
.
对此我很头疼。有谁知道为什么?
当应用程序位于前台时,它不应显示任何内容。
如果您看到alertView,则意味着您为其提供了代码。
大致如下:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
//app is in foreground
//the push is in your control
} else {
//app is in background:
//iOS is responsible for displaying push alerts, banner etc..
}
}
如果你已经实施了pushNotificationDelegate
[UAPush shared].pushNotificationDelegate = self;
然后覆盖,并将其留空
- (void)displayNotificationAlert:(NSString *)alertMessage
{
//do nothing
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)