一.什麼是XMPP
XMPP是一種基於XML的即時通信協議,前身是jabber.
二.爲何要寫XMPP單例
因爲XMPPStream是基於myJID創建的長鏈接,所以在應用程序中應該僅被實例化一次(也就是創建單例)
+ (id)shareInstance
{
static id _s;
if (_s== nil) {
_s = [[[self class]alloc]init];
}
return _s;
}
XMPP
須要添加的庫
在xcode5.0須要加入systemConfiguration庫防止SCnetWork錯誤,5.1版本則不須要
libXml2 添加頭文件搜索路徑$(SDKROOT)/usr/include/libxml2
libresolv
CFNetWork
Security
XMPP採用arc編譯,若是工程是MRC,請進行標記-fobjc-arc
設置完請編譯一下無錯後,在進行下一步xcode