Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:56:36+00:00 2026-06-06T14:56:36+00:00

I receive messages from a Google Talk account, they are shown in the Table

  • 0

I receive messages from a Google Talk account, they are shown in the Table View in the Ios emulator, but when i send it, it is not shown in the Google Talk client (in another computer). This is the code:

-(IBAction)sendchat:(id)sender
{
General *general = [General sharedManager];//It is a singleton class used to store some values that need to be accesible in the whole application.


NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
text=[mensaje text];
NSLog(@"Texto en el body: %@", text);
[body setStringValue:text];
NSArray *dest=[general.firstfrom componentsSeparatedByString:@"/"];//in firstfrom is stored the account from wich we receive the first message. This app cannot start a conversation itself, must only answer

NSLog(@"Destination trimmed: %@", [dest objectAtIndex:0]);//Here, the destination account shows correctly (without the /xxxx stuff, just name@gmail.com)
XMPPMessage *mens=[[XMPPMessage alloc]init];
[mens addAttributeWithName:@"body" stringValue:text];
[mens addAttributeWithName:@"sender" stringValue:general.userlogin];
NSLog(@"text vale: %@", text);
NSXMLElement *messagetosend = [NSXMLElement elementWithName:@"message"];
[messagetosend addAttributeWithName:@"type" stringValue:@"chat"];
[messagetosend addAttributeWithName:@"to" stringValue:[dest objectAtIndex:0]];
[messagetosend addChild:body];
NSLog(@"We are sending to: %@", [dest objectAtIndex:0]);
[self.xmppStream sendElement:messagetosend];

[self xmppStream:xmppStream didReceiveMessage:mens];//manage the sent message as it was received, to show it in the Table View
self.mensaje.text=@"";
}

As I say, messages are received perfectly, but I cannot send. Ive seen plenty of examples of how to send, and they are like my code. If i debug sender it is shown ok (namesender@gmail.com), and the “to” attribute is ok too (namereceiver@gmail.com). The xmppStrem is set correctly (as far as i know):

xmppStream = [[XMPPStream alloc] init];
[xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];

In ViewDidLoad method.

Any help? Thank you.

—EDIT—

I forgot to say, both accounts know each others and in the Google Talk client, the presence is sent.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:56:36+00:00Added an answer on June 6, 2026 at 2:56 pm

    I found the answer. I had two classes receiving messages, because Class A must receive a message to trigger the pushing of the view of the class B (this app is unable to start a chat conversation by itself). So, i set two xmppStream, one for every class. I put an xmppStream in my General class, make both classes take that xmppStream, and it now sends messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to send and receive encrypted messages from/to the iPhone I need to
I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts
I want to build a simple web-interface application that can send/receive chat messages to/from
I am using thread which will receive messages from the external application.So my thread
So I got my ActiveMQ to receive messages from another location woo hoo -
I'm creating a console application that should receive messages from the network in order
I'm implementing a little chat application where I receive messages from a server, which
In our application, we receive messages from JMS Topic. First I want to know
I need a server to send and recieve XMPP messages from Android clients running
I am trying to write an xmpp client to send/recieve messages from gtalk. Before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.