2

I am creating a chat application and sending push notification on new message-

-(void)methodName{
     PFQuery *pushQuery = [PFInstallation query];

     [pushQuery whereKey:@"user" containedIn:objectIds];

     PFPush *push = [[PFPush alloc] init];

     push setQuery:pushQuery];

     NSDictionary *pushData=@{
                           @"alert" : self.messageTxt.text,
                           @"Message" : self.messageTxt.text,
                           @"FirstGroup" : [GroupData valueForKey:@"GroupsOneId"],
                           @"SecondGroup" : [GroupData valueForKey:@"GroupsTwoId"],
                           @"GroupId" : groupObjectIdSend,
                           @"Type"  : @"MutualMessage"
                           };

    [push setData:pushData];

    [push sendPushInBackground];

}

Please help me why i am not getting notification every time.

pkc456
  • 8,350
  • 38
  • 53
  • 109

3 Answers3

2

There are some difference between servers in real APNs and test APNs . Push Notifications are not reliable. This is not your problem.

APNS is based on Apple Servers, and Apple doesn't give any guarantee on successful message delivery.

M Swapnil
  • 2,361
  • 3
  • 18
  • 33
1

Because, Push Notification is not a reliable source. You can't ensure every time your push notification will sent. More see this

Community
  • 1
  • 1
Jamil
  • 2,977
  • 1
  • 13
  • 23
-1

I am having the same problem. It is mostly related to weak internet connection or no internet. However Apple PN are not reliable and you cannot control it. Sometimes it delivers late, sometimes it does not deliver at all. You can track your pushes on Parse Push Console. I would suggest adding additional logic to your app in case delivery of PN fails.

EsmaGo
  • 141
  • 1
  • 7