ios - How to send push notification to purticular group members using parse? -
i developing social messaging app using parse backend. need send push notification group members when texted in group.
my code :
pfquery* getmembers = [pfquery querywithclassname:@"group"]; [getmembers wherekey:@"objectid" equalto:groupid]; [getmembers includekey:pf_recent_user]; [getmembers findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { nsarray *ar = [[nsarray alloc]init]; ar=[[objects objectatindex:0]objectforkey:@"members"]; nslog(@"members %@",ar); pfquery *queryinstallation = [pfinstallation query]; [queryinstallation wherekey:pf_installation_user matcheskey:pf_recent_user inquery:getmembers]; pfpush *push = [[pfpush alloc] init]; [push setquery:queryinstallation]; //[push setmessage:text]; nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys: text, @"alert", @"ursound.caf", @"sound", @"increment", @"badge", // @"optionally type set", @"type", nil]; [push setdata:data]; [push sendpushinbackgroundwithblock:^(bool succeeded, nserror *error) { if (error != nil) { nslog(@"sendpushnotification send error."); } }]; } }];
kindly guide me correct mistake..
you can send push notification gruop members creating channel , subscribe user channel . can send push notification particular channel.
visit https://parse.com/docs/ios/guide#push-notifications more creating channel , send notification using channel.
Comments
Post a Comment