Parse.com后台推送通知未运行

时间:2014-10-14 04:20:05

标签: push-notification parse-platform apple-push-notifications

我正在尝试通过Parse.com向我的服务器发送后台推送通知:

-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    [PFPush handlePush:userInfo];

    if (application.applicationState == UIApplicationStateInactive) {
            [PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
    }

    NSString *CustomData = [userInfo objectForKey:@"CustomField"];

    // ping server to confirm the push notification is delivered, sometimes this is called but not always
    [[DAL sharedInstance] log:CustomData onComplete:nil];

    // do stuff
    if([CustomData isEqualToString:@"CustomItem"])
    {
            // do stuff
    }

当我通过Parse.com的REST API向https://api.parse.com/1/push发送推送通知时

{ "where":{"objectId":"[objectID]"}, "data":{"alert":"test","content-available":"1","CustomField":"CustomItem"} }

我收到警报并且服务器已被ping,但是如果我删除警报

{ "where":{"objectId":"[objectID]"}, "data":{"content-available":"1","CustomField":"CustomItem"} }

没有任何反应,服务器没有被ping。如何无形地发送推送通知并仍然ping服务器?

0 个答案:

没有答案