Welcome to the Treehouse Community
Looking to learn something new?
Nic HuangCourses Plus Student 10,573 Points
Ribbit with push notification
I try to take Ribbit further and add more features to it. I can now successfully send push notification (server - to client) from my Parse console. Devices can receive it. However, my client-to-client push has some issues. When I'm sending a photo to one of my friends, I'm sending notification as well. The notification is sent successful, but none of devices receive it. Parse console always shows 0 recipients and subscribers. I don't understand why. Hope someone with the experience can give me some help. Thanks in advance.
The below are my client to client push code. I think I have everything ready, but devices still can't receive it......
// set PFInstallation in appDelegate PFInstallation *currentInstallation = [PFInstallation currentInstallation]; [currentInstallation setObject:[PFUser currentUser] forKey:@"owner"]; [currentInstallation saveInBackground]; // handle recipient push after sending message NSArray *megRecipients = [message objectForKey:@"recipientIds"]; PFQuery *pushQuery = [PFInstallation query]; [pushQuery whereKey:@"owner" containedIn:megRecipients]; PFPush *push = [[PFPush alloc] init]; [push setQuery:pushQuery]; [push setMessage:[NSString stringWithFormat: @"%@ send you a new message", [PFUser currentUser].username ]]; [push sendPushInBackground];
I came here to ask the exact same thing. I have been working on adding push notifications successfully with Parse for the past 4 hours, and I am at the exact same stage as you.
I'll keep working on it and update if I have anything new.
EDIT: Are you testing with multiple devices? I think that you might not be able to send a push notification to a user account that is not currently signed into the app. I have not tested this on multiple devices, but will do so and check back.
I also created a post on the Parse forums: https://parse.com/questions/sending-a-push-notification-from-one-user-to-another-user
And I just posted on StackOverflow: http://stackoverflow.com/questions/20626513/sending-a-push-notification-from-one-user-to-another-user-with-parse
Some links that are leading me on the right track:
Too bad it isn't part of the course.
Did you get it to work. Please post code. Karma is watching the webb.