ios - 即使正在运行应用程序,是否可以让远程通知显示在通知中心中?

标签 ios ios5 apple-push-notifications

即使我的应用程序正在运行,是否也可以在通知中心中显示远程iOS5通知,例如“即使我正在运行,我现在也不在乎远程通知,而是将其显示在通知栏中好像我没有在跑“?

最佳答案

而是向用户显示UIAlertView。

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    {
        NSLog(@"userInfo :%@",userInfo);

        NSString* msg = [userInfo valueForKey:@"aps"];

        if (self._VCObj.isViewLoaded && self._VCObj.view.window) {
                // viewController is visible don't show.
        }
            else { // viewController is not visible
                [[[UIAlertView alloc]initWithTitle:@"Title" message:msg delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil] show];
            }
        }
    }

Tutorial

关于ios - 即使正在运行应用程序,是否可以让远程通知显示在通知中心中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9019396/

相关文章:

ios - 当从导航堆栈中弹出该 View 时,如何使后台任务完成

iphone - 如何创建真实的 APN 服务器以及如何使用 APN 服务器 iPhone 测试应用程序?

ios - 通话期间未调用远程通知回调

ios - 在 UILabel 中显示核心数据计数,不断更新

ios - View 在屏幕上,但 self.view.window 仍然为零

ios - 将 iOS 应用程序上传到 Apple AppStore

objective-c - 单击 UIButton 以编程方式创建 Segue 或推送到另一个 View Controller

ios - 在iOS中使用commoncrypto解密mp3文件(mp3文件使用openssl加密)

iphone - 应用内购买 - 消耗品

iphone - 如何在 iOS 中卸载我们的应用程序时收到通知