解析ios8用户推送通知操作

时间:2014-07-25 04:06:48

标签: objective-c parse-platform apple-push-notifications ios8

我已正确注册通知操作,并通过调用[[UIApplication sharedApplication] currentUserNotificationSettings]确认。

我正在使用Parse来组装并发送这样的推送:

        NSString *pushMessage = [NSString stringWithFormat:@"%@ just directly asked: %@", [[PFUser currentUser] username], [self.question objectForKey:@"text"]];
        NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
                              pushMessage, @"alert",
                              @"questionNotification", @"category",
                              nil];

        PFPush *push = [[PFPush alloc] init];
        [push setQuery:pushQuery];
        [push setData:data];
        [push sendPushInBackground];

通知确实已发送到设备,但它没有任何已为该类别注册的可用自定义操作。

此时我觉得Parse无法正确传达有效载荷中的类别?有没有人让他们与Parse一起工作?

编辑: 这是我从currentUserNotificationSettings获得的响应,它使我成功注册了操作:

<UIUserNotificationSettings: 0x14e3eaa0; types: (UIUserNotificationTypeAlert UIUserNotificationTypeBadge UIUserNotificationTypeSound);categories: {(
<UIUserNotificationCategory: 0x14e54c40; identifier: questionNotification, actions: {
1 =     (
    "<UIMutableUserNotificationAction: 0x14e4b860; identifier: yupAction, title: YUP activationMode: UIUserNotificationActivationModeBackground, isAuthenticationRequired:NO, isDestructive:NO>"
);}>)};>

更新:更多研究,以防其他人遇到此问题,当我输出从推送通知收到的userInfo时,我得到:
{aps = {alert = "m just directly asked: Abaxinj";}; category = "QUESTION_CATEGORY";}

所以似乎Parse将类别字段放在aps容器之外,这可能就是问题所在。

1 个答案:

答案 0 :(得分:3)

打开Parse的一个错误,他们证实他们还没有能力处理这个问题。当他们添加ios8的新功能时,他们说要检查Parse.com博客的更新。

相关问题