imO*_*ing 4 objective-c apple-push-notifications urbanairship.com ios
根据我的理解,当应用程序正在运行或在前台并且收到推送通知时,应用程序不应显示任何警报,但应用程序委托将调用didReceiveRemoteNotification委托方法,我应该在该回调中处理推送通知.
当应用程序在后台时,推送通知应仅显示警报/横幅.
但是,我们的应用程序在应用程序运行时或在某个时间(而不是所有时间)在前台获得推送通知警报.我想知道它是否是iOS 7中的新功能(我从未听说过这个)或是因为我正在使用用户的UrbanAirshipiOS应用程序的推送通知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..
}
}
Run Code Online (Sandbox Code Playgroud)
如果你已经实施了 pushNotificationDelegate
[UAPush shared].pushNotificationDelegate = self;
Run Code Online (Sandbox Code Playgroud)
然后覆盖,并将其留空
- (void)displayNotificationAlert:(NSString *)alertMessage
{
//do nothing
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6676 次 |
| 最近记录: |