如何获取推送通知的文本(Urban Airship)

时间:2012-09-13 09:03:38

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

我搜索了我的问题并没有找到答案。所以我使用城市飞艇推送通知,它工作正常。所以现在我想做到这一点:当用户点击通知打开应用程序时,我想在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];}

非常感谢。

1 个答案:

答案 0 :(得分:0)

我可以阅读使用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;
}