【问题标题】:how to get text of push notification (Urban Airship)如何获取推送通知的文本(Urban Airship)
【发布时间】:2012-09-13 09:03:38
【问题描述】:

我搜索了我的问题,但没有找到答案。所以我正在使用城市飞艇推送通知,它工作正常。所以现在我想做这个:当用户点击通知打开应用程序时,我想在 uialertview 中再次给他通知文本。 那么我可以在哪里获取通知文本? 我可以用这个方法吗?

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

 UIApplicationState appState = UIApplicationStateActive;
    if ([application respondsToSelector:@selector(applicationState)]) {
        appState = application.applicationState;
    }

    [[UAPush shared] handleNotification:userInfo applicationState:appState];
    [[UAPush shared] resetBadge];}

非常感谢。

【问题讨论】:

    标签: push-notification push apple-push-notifications urbanairship.com


    【解决方案1】:

    我可以阅读使用didReceiveRemoteNotification:(NSDictionary *)userInfo 打开我的应用程序的推送通知 - 这是我的didReceiveRemoteNotification

    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    
        // TestFlight API
        TESTFLIGHT_CHECKPOINT(@"Receive Remote Notification");
    
        // Urban Airship
        [[UAPush shared] handleNotification:userInfo applicationState:application.applicationState];
        NSLog(@"userInfo: %@",userInfo);
        [UAInboxPushHandler handleNotification:userInfo];
    }
    

    当我从一个 aps 通知启动我的应用程序时,我在调试窗口中有这个:

    2013-01-17 20:52:49:947 iFlightBag[8229:2311] -[AppDelegate_Shared application:didReceiveRemoteNotification:] [Line 2403] userInfo: {
        "_" = "l0-mgGElEeKbHAAbIbyL6A";
        aps =     {
            alert = "Manual: IOM update 2013-01-17T20:14:42-08:00";
            badge = 0;
        };
        operation = update;
        tab = manuals;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多