iOS 即时通讯协议XMPP学习之xmppframework引入项目过程(三)

今天的内容不复杂,也是来自国外教程,只是做个记录,怕自己忘了,所以翻译的话就先等等

Project Setup

Let’s open Xcode and start a new project. We will choose a simple view based application and we will name it “JabberClient”. To interact with the server, we will adopt a handy library for iOS which is called XMPP framework. This library is compatible with both Mac and iOS applications and will help us in implementing the low-level functionalities to connect with XMPP server and manage message exchanges through sockets. Since the repository does not feature any download link you need to have git installed (see herefor more information). Once you have installed git, you can issue the following command in the console:

git clone https://code.google.com/p/xmppframework/ xmppframework

Once the download has completed we should end up with a folder like the following:

XMPP Framework Folders

We need only the folders highlighted in the picture. Once selected, we drag them over the project to include them. Just remember to check “Copy items into destination group’s folder (if needed)”.

Importing XMPP Framework

We don’t need the integration with Facebook, so in the “Extensions” group we can delete the “X-FACEBOOK-PLATFORM” folder.

Deleting Facebook Part

Now let’s add the frameworks needed. We select the project in the navigator, then we select the target and we open “Link Binary With Libraries” as shown in the figure.

Adding Frameworks for Proejct

We have to add lots of framework as shown in the following figure:

List of Frameworks needed for the Project

Finally, to compile a project we have to tweak some build settings. Changes have to be added to both the project and the target. First, we find the “User Header Search Paths” and we specify the library needed to parse xml: ‘/usr/include/libxml2′

Including xml2 library

Then we select “Other Linker Flags” and the add the following flag: “-lxml2″.

Including xml2 library

The project is now set up correctly and you should be able to build it without errors or warnings.

posted @ 2012-12-21 21:53  追风筝的小蜗牛  阅读(135)  评论(0)    收藏  举报