0

我正在尝试通过发送推送通知

PFPush *push = [PFPush push];
[push setQuery:pushQuery];
[push setPushToIOS:YES];
[push setData:data];
[push sendPushInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (!succeeded)
        WMLog(@"Push sending Error: %@", error);
    else
        WMLog(@"Push Sent.");
}];

parse.com Push Notifications 列表以某种方式表示订阅者数量收到了推送通知。但有时它没有在某些设备上同时接收到某些设备正在接收该通知,有时所有设备都接收到所有推送通知。那么,有时设备上没有收到通知的原因可能是什么。期待你的回复。

编辑: 代码是:

    PFQuery *requestFromQuery = [PFQuery queryWithClassName:kMPFRequestsClassKey];
    [requestFromQuery whereKey:kMPFActivityStatusKey equalTo:kMPFFriendStateConnected];
    [requestFromQuery whereKey:kMPFActivityFriendKey equalTo:objC.objUser];

    PFQuery *fromQuery = [PFQuery queryWithClassName:kMPFReflectionsClassKey];
    [fromQuery whereKey:kMPFUsersClassKey matchesKey:kMPFUsersClassKey inQuery:requestFromQuery];

    PFQuery *requestToQuery = [PFQuery queryWithClassName:kMPFRequestsClassKey];
    [requestToQuery whereKey:kMPFActivityStatusKey equalTo:kMPFFriendStateConnected];
    [requestToQuery whereKey:kMPFUsersClassKey equalTo:objC.objUser];

    PFQuery *toQuery = [PFQuery queryWithClassName:kMPFReflectionsClassKey];
    [toQuery whereKey:kMPFUsersClassKey matchesKey:kMPFActivityFriendKey inQuery:requestToQuery];

    PFQuery *reflectionsQuery = [PFQuery orQueryWithSubqueries:[NSArray arrayWithObjects:fromQuery, toQuery, nil]];
    [reflectionsQuery orderByDescending:@"updatedAt"];
    [reflectionsQuery setLimit:1000];

    PFQuery *pushQueryFriends = [PFInstallation query];
    [pushQueryFriends whereKey:kMPFInstallationUserKey matchesKey:kMPFUsersClassKey inQuery:reflectionsQuery];

    PFQuery *pushQueryOwners = [PFInstallation query];
    [pushQueryOwners whereKey:kMPFInstallationUserKey equalTo:objC.objUserReflectionOwner];

    PFQuery *pushQuery = [PFQuery orQueryWithSubqueries:[NSArray arrayWithObjects:pushQueryFriends, pushQueryOwners, nil]];
    [pushQuery whereKey:kMPFInstallationNotificationEnableKey equalTo:[NSNumber numberWithBool:YES]];
    [pushQuery whereKey:kMPFInstallationUserKey notEqualTo:[PFUser currentUser]];
4

0 回答 0