Ios UIApplicationStateActive时如何处理通知

Ios UIApplicationStateActive时如何处理通知,ios,xcode,ios5,xcode4.3,Ios,Xcode,Ios5,Xcode4.3,我已经设置了一个注册远程通知的应用程序 - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo { NSString *status = [NSString stringWithFormat:@"Notification Received:\n%@",userInfo.description]; NSLog(@"%@",sta

我已经设置了一个注册远程通知的应用程序

- (void)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{    
    NSString *status = [NSString stringWithFormat:@"Notification Received:\n%@",userInfo.description];
    NSLog(@"%@",status);

    UIAlertView *alert=[[UIAlertView alloc] 
                        initWithTitle:@"didReceiveRemoteNotification" 
                        message:eventName
                        delegate:self 
                        cancelButtonTitle:@"Hide" 
                        otherButtonTitles:@"View", 
                        nil];
    alert.tag = kAlertTypeNotification;
    [alert show];
    [self vibrate];


if ( application.applicationState == UIApplicationStateActive ) {
    // app was already in the foreground
    **DO SOMETHING HERE**

}
else {
    // app was just brought from background to foreground

}
}
因此,当应用程序未激活时,我会收到非常漂亮的横幅提醒,在iPhone上看起来非常漂亮

然而,当应用程序打开时,我唯一的选择似乎是显示UIAlertView。在我看来,这是侵入性的。当application.applicationState==UIApplicationState处于活动状态时,是否有办法显示横幅?或者,有没有实现这种特性的开源库


谢谢你的帮助

当应用程序在前台时,你可以做任何你想做的事情。谁说你必须显示UIAlertView?

当应用程序在前台时,你可以做任何你想做的事情。谁说你必须显示UIAlertView?

我在这里更直接地问了这个问题:

简单的回答是,从iOS 9开始,当你的应用在前台时,你不能显示股票iOS横幅

您将不得不依赖于自制或第三方通知横幅


请复制此雷达以请求此功能:rdar://22313177我在这里更直接地问了这个问题:

简单的回答是,从iOS 9开始,当你的应用在前台时,你不能显示股票iOS横幅

您将不得不依赖于自制或第三方通知横幅


请复制此雷达以请求此功能:rdar://22313177

我正在寻找一种在没有UIAlertView的UIWebView中通知用户的方法。我觉得我的选择几乎只限于一个视图。像顶部的横幅这样的小东西听起来很棒。但是,我不确定是否可以在应用程序处于活动状态时执行此操作。我正在寻找一种在没有UIAlertView的UIWebView中通知用户的方法。我觉得我的选择几乎只限于一个视图。像顶部的横幅这样的小东西听起来很棒。但是,我不确定是否可以在应用程序处于活动状态时执行此操作。