[IOS XMPP] use XMPPFramewok (a): Add XMPPFramework (XCode 4.6.2)

XMPPFramework

GitHub: https://github.com/robbiehanson/XMPPFramework

 

Source code

git clone https://github.com/robbiehanson/XMPPFramework.git

checkout XMPPFramework a new  branch

 

Add dependent

> Copy <XMPPFramework> / Vendor / CocoaLumberjack to the root directory of the project, add files ..., select the folder CocoaLumberjack

> The same procedure, and copy CocoaAsyncSocket KissXML and added to the project

CocoaAsyncSocket 依赖 CFNetwork.framework 和 Security.framework,在 TARGETS -> Build Phases -> Link Binary With Libraries 添加

KissXML using libxml2 parse XML, so

First, we need TARGETS - Link Binary With Libraries Add libXML2.dylib> -> Build Phases

然后,在 TARGETS -> Build Settings -> Other Linker Flags 添加 -lxml2,TARGETS -> Build Settings -> Header Search Paths 添加 /usr/include/libxml2

> Copy <XMPPFramework> / Vendor / libidn to the project root directory, the file libidn.a static library and header file and idn-int.h stringprep.h

 

Add XMPPFramework

Authentication in the copy source directories and Utilities Categories Core to the project root directory and added to the project

Further, the need to add a dynamic link library libresolv.dylib, in TARGETS - Add Link Binary With Libraries> -> Build Phases

 

Add extension

You can according to their needs, add <XMPPFramework> / Extensions extensions to the project 

Problems you may encounter:

> "XMPPFramework.h" file not found

XMPPFramework.h follows, falsification can be based on actual usage module:

#import "XMPP.h"

// List the modules you're using here.

#import "XMPPReconnect.h"

#import "XMPPRoster.h"
#import "XMPPRosterCoreDataStorage.h"

#import "XMPPvCardTempModule.h"
#import "XMPPvCardAvatarModule.h"
#import "XMPPvCardCoreDataStorage.h"

#import "XMPPCapabilities.h"
#import "XMPPCapabilitiesCoreDataStorage.h"

#import "XMPPMUC.h"
#import "XMPPRoomCoreDataStorage.h"

 

There are some problems, because there is no need to add dependent libraries produced Extension

可在 TARGETS -> Build Phases -> Link Binary With Libraries 添加

CoreData.framework SystemConfiguration.framework CoreLocation.framework

 

ARC warning

XMPPFramework use ARC, then if your project does not use ARC, build and you get lots of ARC warning.

Do not ignore these warnings, it will cause your program to crash due to memory leak ......

Edit -> Refactor -> convert to Objective-C ARC, to eliminate these warnings!

 

Reference:  https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_iOS

 

Reproduced in: https: //www.cnblogs.com/dyingbleed/archive/2013/05/09/3069145.html

Guess you like

Origin blog.csdn.net/weixin_34237596/article/details/93301867