Hi,
I’m using the required methods in Appdelegate to register a device for Push. I’m able to use the web console to send pushes. They work as they should.
I’m using the following code to store the device registration to my user table.
NSString *messagingChannel = @"ios";
NSString *registeredDevice = [backendless.messaging registerDevice:@[messagingChannel]];
NSLog(@"registered device: %@", registeredDevice);
[user setProperty:@"deviceId" object:registeredDevice];
[backendless.userService update:user];
I’m able to save these details and retrieve them using the following code
BackendlessUser *user = [backendless.userService currentUser];
NSString *objectID = [user getProperty:@"objectId"];
[backendless.userService findById:objectID response:^(BackendlessUser *user) {
NSLog(@"User Details %@", [user getProperty:@"deviceId"]);
self.nameLabel.text = [user getProperty:@"name"];
} error:^(Fault *fault) {
NSLog(@"Error retrieving user details: %@", fault);
}];
Here it shows the current device’s “device ID”.
How ever when I try to send a push using this device ID, it is never delivered. And by cross checking the user table and Messaging Table, I get a complete different set of Device IDs.
Messaging Table shows these
http://support.backendless.com/public/attachments/93a9fb28638af607da63ff21b56a0b77.png</img>
vs User Table shows these
http://support.backendless.com/public/attachments/c7ffc95e1719a18d6c20bedd54c31187.png</img>
I tried hard-coding the messaging table values and i see that pushes being delivered.
How do I retrieve these values to store in the user table. What am I doing wrong here?
Thanks.