接上一章的,这一章我们着重介绍XMPP
为了方便程序调用,我们把XMPP的一些主要方法写在AppDelegate中
在AppDelegate.m下这几个方法为:
-(void)setupStream{//初始化XMPPStreamxmppStream = [[XMPPStream alloc] init];[xmppStream addDelegate:self delegateQueue:dispatch_get_current_queue()];}-(void)goOnline{//发送在线状态XMPPPresence *presence = [XMPPPresence presence];[[self xmppStream] sendElement:presence];}-(void)goOffline{//发送下线状态XMPPPresence *presence = [XMPPPresence presenceWithType:@"unavailable"];[[self xmppStream] sendElement:presence];}-(BOOL)connect{[self setupStream];