Read a lot of tutorials, some are very old, some write too simple, and the actual operation will appear a lot of compilation error, and hereby write down for reference later.
It is best to follow the step by step into the framework, every step to compile, to find errors in time to correct, or in the end will be very troublesome.
First step new project Chatdemo
Step two Download the latest version of Xmppframewok
Address: Https://github.com/robbiehanson/XMPPFramework
The third step is to create a new directory 3rd under the Chatdemo directory and create a new XMPP directory under the 3rd directory.
Fourth Step add cocoalumberjack Log Frame
Create a new vendor directory under the XMPP directory.
Copy the downloaded <xmppframework>/vendor/cocoalumberjack to the Vendor directory.
Fifth Step to add cocoaasyncsocket Lightweight Network Framework
Copy the downloaded <xmppframework>/vendor/cocoaasyncsocket to the Vendor directory.
Cocoaasyncsocket relies on cfnetwork.framework and security.framework,
So you need to add cfnetwork.framework and security.framework to Link Binary with Libraries, Build phases, TARGETS
Sixth Step add kissxml entity class Framework
Copy the downloaded <xmppframework>/vendor/kissxml to the Vendor directory.
Kissxml uses LIBXML2 to parse XML, so
First, we need to add the Link Binary with Libraries, TARGETS---Build phases Libxml2.dylib
Then, in TARGETS-Build Settings, other Linker Flags add-lxml2,
Finally, add/USR/INCLUDE/LIBXML2 to the Header Search Paths, Build Settings, targets
Seventh Step add libidn
Copy <xmppframework>/vendor/libidn to Vendor, add static library files Libidn.a and header files Idn-int.h and Stringprep.h
Eighth Step Add authentication Categories Core and Utilities
1. Add the source directory to the authentication Categories Core and Utilities folder to the project folder XMPP
2. Add a dynamic connection library to link Binary with Libraries, Build phases, TARGETS libresolv.dylib
nineth Step Add XMPPFramework.h to the XMPP directory
XMPPFramework.h content as follows, can be based on their own project needs to be censored
#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"
The tenth step is to add <xmppframework>/Extensions to the XMPP directory based on your project needs
Add a dependent library of extensions on Link Binary with Libraries, Build phases, TARGETS:
Coredata.framework systemconfiguration.framework Corelocation.framework
If the project does not use arc, there may be many arc warnings after compilation,
Make the following settings edit-refactor convert to Objective-c ARC
The final project directory is as follows