Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Dee Greene
8,508 PointsSending Parse notifications to multiple users
I am sending push notifications from my app via Parse.com. My code works and pushes are sent, however they are only sent when one user is selected. When multiple users are selected no pushes are sent or received.
Here is my code that sends the push:
PFQuery *pushQuery = [PFInstallation query];
PFQuery *recipients = [PFUser query];
[recipients whereKey:@"objectId" containedIn:self.imageOrVideoRecipients];
//send to msg recipients
[pushQuery whereKey:@"user" matchesQuery:recipients];
// Send push notification to query
NSString *companyName = [[PFUser currentUser] objectForKey:@"companyName"];
NSString *firstName = [[PFUser currentUser] objectForKey:@"firstName"];
NSString *lastName = [[PFUser currentUser] objectForKey:@"lastName"];
NSString *fullName = [NSString stringWithFormat:@"%@ %@", firstName, lastName];
NSDictionary *data = @{
@"alert" : [NSString stringWithFormat:@"Message from %@ at %@", fullName,companyName],
@"badge" : @"Increment"
};
PFPush *push = [[PFPush alloc] init];
[push setQuery:pushQuery]; // Set our Installation query
[push setData:data];
[push sendPushInBackground];
1 Answer
landonferrier
25,097 PointsDee, I recently released a social network template with this functionality. It might be of some use to your product: Lion - An Advanced Social Network Template
If you have any questions, feel free to ask!