thank you for your coming. I am developing an app which uses amazon aws service and it is a messenger. I would like to use IOS Push Notification service and the amazon SNS to achieve the communication between 2 users. I am able to send message from the SNS console by publishing a message to the destination called endpoint. However, i am not able to send message from one mobile to another mobile by amazon SDK of IOS. Can i do it in that way by the API of Amazon?? I want to send the NSDictionary called messageDict to the destination endPoint. Can i achieve this without the use of server??
Thank you very much for your answers
NSDictionary *messageDict = [[NSDictionary alloc]init];
messageDict = @{ @"Name" : @"HelloWrold" ,@"Id" :@"GoodBye",};
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:messageDict options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"Jsonstring %@",jsonString);
AWSSNS *publishCall = [AWSSNS new];
AWSSNSPublishInput *message = [AWSSNSPublishInput new];
message.subject = @"My First Message";
//This is the ending point
message.topicArn = @"arn:aws:sns:us-east-1:1234152121:endpoint/APNS_SANDBOX/appTesting/201sjad-5246-3ddsfe-9s13-c34sdfdsf1d9c";
message.messageAttributes = messageDict;
message.messageStructure = jsonString;
[[publishCall publish:message]continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task){
if (task.error != nil) {
NSLog(@"Error %@",task.error);
}
else{
NSLog(@"Successful");
}
return nil;
}];
Aucun commentaire:
Enregistrer un commentaire