iOS push notification problem

I am trying to send push notification to a specific device but that specific device does not receive notification. I am using the following method:
-(void)sendMessageAsPushNotificationAsync:(NSString *)message forDevice:(NSString *)deviceId
{
DeliveryOptions *deliveryOptions = [DeliveryOptions new];
deliveryOptions.pushSinglecast = (NSMutableArray *) @[deviceId];

[DeliveryOptions deliveryOptionsForNotification:PUSH_ONLY];

PublishOptions *publishOptions = [PublishOptions new];

publishOptions.headers = @{
@“1”: @“ios-badge”,
@“Sound12.aif”:@“ios-sound”,
};

[backendless.messagingService
publish:@“default” message:message publishOptions:publishOptions deliveryOptions:deliveryOptions
response:^(MessageStatus *messageStatus)
{
NSLog(@“MessageStatus = %@ <%@>”, messageStatus.messageId, messageStatus.status);
}
error:^(Fault *fault)
{
NSLog(@“FAULT = %@”, fault);
}
];
}
I think the problem is deviceId, I am passing device token to this method, what is deviceId and how can I retrieve it ?

Hi Ali,

Please see the following sample which demonstrates how to register device and receive push notifications:

Regards,
Mark

Thanks for you reply, I have already checked this sample, the problem is

‘didRegisterForRemoteNotificationsWithDeviceId’ delegate is not called. I actually want to sent push notification to a specific device and for that i need deviceId, how can I get this deviceId while registering app for push notification ? and registerDeviceToken returns a string that is different from the deviceID saved for the device to my Messages console.
Please see the file attached.

AppDelegate.rtf (5.16kB)

The problem is now resolved. Thanks

Could you tell what was your problem?

Cuz Im also having issues trying to get the push notifications on my device

Thanks!

I was having problem with the deviceId.

UIDevice *device = [UIDevice currentDevice];
NSString *deviceId = [[device identifierForVendor] UUIDString];

Using these two lines get the deviceId of the device and save it in your database and when ever you want to send push notification to a specific device then get the deviceId of that specific device from your database and then use the method I added in my question on the top.