【问题标题】:How to detect Push notification when app is open [duplicate]应用程序打开时如何检测推送通知[重复]
【发布时间】:2014-06-06 19:29:15
【问题描述】:

在我的应用程序中,我使用了推送通知服务,但我的问题是,当我当时关闭应用程序时会出现通知,但是当我打开应用程序然后发送通知时,通知不会出现。请帮帮我。

【问题讨论】:

    标签: ios push-notification


    【解决方案1】:

    您可以在appDelegate.m通过下面提到的此功能轻松处理

    ---实现application:didReceiveRemoteNotification:

    示例:-

    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
    {
    
        UIApplicationState appState = [application applicationState];
        if (appState == UIApplicationStateActive)
        {
    
                UIAlertView *alertVw = [[[UIAlertView alloc] initWithTitle:@"Notify" message:yourMessage delegate:self cancelButtonTitle:@"Done" otherButtonTitles: @"vizllx", nil] autorelease];
    
                [alertVw show];
        }
        else {
            // Push Notification received while app is in background
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2017-11-21
      • 2013-04-29
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 2015-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多