Open gespim opened 9 years ago
You could update the installation table with you user id yourself. Try this REST API: https://parse.com/docs/rest/guide#push-notifications-updating-installations
Or you can 'hack' the table from your JS code, var Installation = Parse.Object.extend("_Installation");
note the underscore.
I guess many folks using this plugin will face this issue. Because saving user obj to the installation is needed for targeted push notification. I finally made it work at 4:15am -:) for my ClassMade app (www.iClassMade.com), an app for college students to find girl/boy friends.
Here is how I made it work. I modified the getInstallationId function to let it take one parameter userid
and then in the CDVParsePlugin.m the getInstallationId function add the following code
//we just need to pass the userid from JS code to this function, and we can save it to the Installation @"rKGIJNHipB" NSString userid = [command.arguments objectAtIndex:0]; PFInstallation installation = [PFInstallation currentInstallation];
installation[@"user"] = [PFObject objectWithoutDataWithClassName:@"_User" objectId:userid]; [installation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { if (error != nil) { NSLog(@"ParsePushUserAssign save error."); } }];
then in my html js code, after user login just call
parsePlugin.getInstallationId(user.id,function(id) { console.log(id +" id");
cheers!