Support Topics Documentation Slack YouTube Blog

send message to single device objective c

i want to send message to a single device here is my code

-(void)publishMessageAsPushNotificationAsync:(NSString *)message forDevice:(NSString *)deviceId

{

DeliveryOptions *deliveryOptions = [DeliveryOptions new];

deliveryOptions.pushSinglecast =@"6BEF673B-A079-4A49-8FDC-AD82D249634F";



PublishOptions *publishOptions = [PublishOptions new];

[publishOptions assignHeaders:@{@"ios-text":@"Push notification for iOS",

                                @"ios-badge":@"1",

                                @"android-content-title":@"Notification title for Android",

                                @"android-content-text":@"Notification text for Android"}];



[backendless.messaging

 publish:@"default" message:message publishOptions:publishOptions

 deliveryOptions:deliveryOptions

 response:^(MessageStatus *messageStatus) {

     NSLog(@"MessageStatus = %@ <%@>", messageStatus.messageId, messageStatus.status);

 }

 error:^(Fault *fault) {

     NSLog(@"FAULT = %@", fault);

 }

 ];

}

whats wrong in it Cab any bady please help me

Hello,

deliveryOptions.pushSinglecast =@“6BEF673B-A079-4A49-8FDC-AD82D249634F”;
what is 6BEF673B-A079-4A49-8FDC-AD82D249634F ?

its device id whom i want to send notification

can you please send me the method from which i can send push notification on a single device

Hello!

Please, check this doc, the “Targeting” specific devices paragraph.

Regards, Olga

hi Olga !
Actually this method give exception

FAULT = ‘-1200’ [NSURLErrorDomain] <An SSL error has occurred and a secure connection to the server cannot be made.>

Do you have NSAppTransportSecurity key with NSAllowsArbitraryLoads=true in your Info.plist?

Regards, Olga

yes i add it and allow it Yes but still getting this issue

Please share the simple project so we could check where the error occurs.

Regads, Olga

here in my full project … at the end of signUpVc class i write the function sendmessage through in this fucation i call the send message method please check that

Please attach your project or send it to support@backendless.com
We do not need the whole project itself, as far as it takes too much time to figure out what causes the issue, as the problem might be in your code as well. Please debug your project and send us the code which is failing

Regards, Olga

I’m having the same problem, except I’m trying to send to iOS from the business logic JS (v3). What is the deviceId Backendless expects? (for the record, I also thought it was something along the lines of 6D2B899F-E620-32B1-FFEF-747EEB2B5F00 , a string representation of the deviceToken returned in the appDelegate method didRegisterForRemoteNotificationsWithDeviceToken

Hi, Gal.
Could you send a simple project that demonstrates a problem ? (here or to support@backendless.com).