标签:
- (
void
)connect {
if
(self.xmppStream == nil) {
self.xmppStream = [[XMPPStream alloc] init];
[self.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
}
if
(![self.xmppStream isConnected]) {
NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:@
"username"
];
XMPPJID *jid = [XMPPJID jidWithUser:username domain:@
"lizhen"
resource:@
"Ework"
];
[self.xmppStream setMyJID:jid];
[self.xmppStream setHostName:@
"10.4.125.113"
];
NSError *error = nil;
if
(![self.xmppStream connect:&error]) {
NSLog(@
"Connect Error: %@"
, [[error userInfo] description]);
}
}
}
标签:
原文地址:http://my.oschina.net/stane/blog/393483