为了更改我的记录状态,我使用了以下代码:
XMPPPresence *presence = [XMPPPresence presenceWithType:@"away"];
[[self xmppStream] sendElement:presence];
但我没有得到[self xmppStream]
. 于是我改成了下面的代码:
XMPPPresence *presence = [XMPPPresence presence];
NSXMLElement *status = [NSXMLElement elementWithName:@"status"];
[status setStringValue:@"away"];
[presence addChild:status];
NSError *error = nil;
xmppStream = [[XMPPStream alloc] init];
[xmppStream disconnect];
NSString *myJID = [NSString stringWithFormat:@"%@", appDelegate.jid];
XMPPJID *JID;
JID = [XMPPJID jidWithString:myJID];
NSLog(@"%@",JID);
[xmppStream setMyJID:JID];
xmppStream.hostName=@"talk.google.com";
[xmppStream connect:&error];
[xmppStream sendElement:presence];
仍然没有得到改变的状态。请分享你的想法。提前致谢。