原始地址:XMPPFrameWork IOS 开发(二)

译文地址:   Getting started using XMPPFramework on iOS

介绍

ios上的XMPPFramework你能够在Xcode/iPhoneXMPP 目录找到,它只是实现了XMPP的一小部分功能。

下面主要介绍在开发XMPPFramework ios应用之前的配置工作。

你最好一步一步的来。

第一步

下载最新的XMPPFramework 代码。下载

第二步

XMPPFramework 有许多关联文件,它们已经内置在你抓下来的工程中,下面是它们的简单介绍。

CocoaLumberjack    一个日志框架


第三步

CocoaAsyncSocket 轻量级的网络框架

需要添加CFNetwork.framework  Security.framework.


第四步

KissXML  xml的一个实体类框架

需要添加libxml2

第五步

libidn     

需要添加的文件(在抓下来的工程中找)

  • Vendor/libidn/idn-int.h
  • Vendor/libidn/stringprep.h
  • Vendor/libidn/libidn.a

第六步

添加下面的文件夹到xcode工程中

  • Authentication
  • Categories
  • Core
  • Utilities

需要添加libresolv.dylib


XMPPFRAMEWORK 介绍

 参考实例

原文:

Introduction

The project comes with a sample Xcode project demonstrating running XMPPFramework on iOS. You can find it in the Xcode/iPhoneXMPP folder. This is not designed to be a full fledged application. It simply serves to show the potential of the framework as well as providing a concrete example of using the code on the iOS platform. Feel free to play with the project, and browse the AppDelegate code. Keep in mind that this sample project only makes use of a small portion of available functionality.

When you're ready to add the XMPPFramework to your own iOS project, this page will provide detailed instructions. (You can also use the included iPhoneXMPP Xcode project as a reference.)

It's best to work step by step. Don't skip steps.

Step 1

Use source control to checkout the latest version of the project. The default branch contains the latest stable version of the code.

(We are moving towards a more structured repository with tagging. But bear with us for now.)

Step 2

The framework has several dependencies. You do NOT have to git clone them separately. They are all included when you clone XMPPFramework, within the Vendor folder. We are going to walk through each dependency step-by-step, ensuring your project complies at the end of each step.

The first dependency is CocoaLumberjack. This is the logging framework used throughout the project.

(More information about this logging framework can be found on the Intro to XMPPFramework page. Plus there is a ton of documentation available on Lumberjack's project page.)

(You don't need to separately clone CocoaLumberjack. It's included in the Vendor folder when you clone XMPPFramework.) Copy Vendor/CocoaLumberjack into your project, and add to your Xcode project.

Lumberjack doesn't have any sub-dependencies or special required frameworks.

Ensure your project compiles.

Step 3

The second dependency is CocoaAsyncSocket. This is the low-level networking code used by the framework.

(You don't need to separately clone CocoaAsyncSocket. It's included in the Vendor folder when you clone XMPPFramework.) Copy Vendor/CocoaAsyncSocket into your project, and add to your Xcode project.

This dependency requires you to add Apple's CFNetwork framework to your project. (*In Xcode 4, go to Target -> Build Phases -> Link Binary With Libraries -> + -> Select CFNetwork from drop down list*)

This dependency also requires Apple's Security framework. (*In Xcode 4, go to Target -> Build Phases -> Link Binary With Libraries -> + -> Select Security from drop down list*)

Ensure your project compiles.

Step 4

The third dependency is KissXML. Since Apple did not include the NSXML classes in iOS (NSXMLDocument, NSXMLElement, NSXMLNode), we use KissXML as a drop in replacement.

(You don't need to separately clone KissXML. It's included in the Vendor folder when you clone XMPPFramework.) Copy Vendor/KissXML into your project, and add to your Xcode project.

KissXML uses libxml2 internally. Follow these detailed instructions (with pictures) explaining how to properly add libxml2 to your Xcode project. After you have done so, ensure your project compiles.

Step 5

The fourth and final dependency is libidn. Add the following files to your project, and add to your Xcode project:

  • Vendor/libidn/idn-int.h
  • Vendor/libidn/stringprep.h
  • Vendor/libidn/libidn.a

The last file listed above (libidn.a) is a static library, compiled as a fat binary including many architectures (x86*64, i386, ppc, armv6, armv7). As a result, it is a rather large file (1.3 MB). But fear not! The compiler will extract only those architectures it needs. Additionally it will extract only the portions of the library that get used, which in our case is only tiny portion of the entire library. In other words, this library won't add any significant size to your application!

Note: The source code for libidn is included in the project. (libidn-1.15.tar.gz) Obviously you should NOT add this to your project.

Ensure your project compiles.

Step 6

Add the following folders to your project, and add to your Xcode project:

  • Authentication
  • Categories
  • Core
  • Utilities

In addition, add libresolv.dylib to your Xcode project. (In Xcode 4, go to Target -> Build Phases -> Link Binary With Libraries -> + -> Select libresolv.dylib from drop down list)

Ensure your project compiles.

And now you're ready to start using XMPPFramework in your project. The Intro to XMPPFramework page explains how to do this.

Common Installation Problems

In XCode 4.2.1 (and perhaps other versions), following these directions will allow a bare bones project to compile. However, upon importing an XMPPFramework class, such as by calling '#import XMPP.h' will cause XCode to show an error 'XMPP.h' not found. It appears that XCode is not finding any of the XMPPFramework files.

The fix for this is to make sure that you DID NOT just drag and drop the XMPPFramework files into your project. Notice in this wiki is says to copy the files into your project folder, and then add the files into your project. So, if your XCode project is called XMPPTest, there will be an XMPPTest folder wherever you created your project, as in /Users/johndoe/XMPPTest. Taking step 2 for example, you need to press the "option" key and drag the folder titled "CocoaLumberjack" into /Users/johndoe/XMPPTest. THEN you can drag the "CocoaLumberjack" folder inside /Users/johndoe/XMPPTest into your actual XCode project. When you do, you should be sure to check the box "Copy items into destination's group folder (if needed) and select the radio button "Create folder references for any added folders". You should make sure that the checkboxes inside the "Add to targets" box are checked.

If you do not do this, XMPPFramework will not be functional.

In XCode 4.6.1, using iOS SDK 6.1, XMPPFramework was not functional when I imported using folder references. I had to use groups to get things working.

In some cases, you may need to also add the file libxml2 by clicking on your target->build phases-> link binary with libraries -> click on the "+" sign -> libxml2.2.7.3dylib

When you see mach linker errors, make sure you have added the security framework (which is not mentioned in the tutorial).

Extensions

Keep in mind that various optional extensions may have other requirements. For example, core data storage classes are obviously going to require the CoreData framework. If you add an optional extension to your project, and you get linker errors, then take a look at the various #imports in the header and implementation files within the extension that you added. If you see something like this:

#import <SystemConfiguration/SystemConfiguration.h>

Then one can deduce that they'll need to add the SystemConfiguration framework to their project.

Automatic Reference Counting (ARC)

The latest versions of XMPPFramework use ARC. If you're not using ARC in your project, learn how to properly flag the XMPPFramework files as ARC in your Xcode project on the ARC page.

If still ARC-related issues persist, make sure you removed the Facebook integration.

Questions

If you have questions concerning XMPPFramework, feel free to make use of the XMPPFramework Mailing List.

XMPPFrameWork IOS 开发(二)- xcode配置的更多相关文章

  1. iOS开发-二维码扫描和应用跳转

    iOS开发-二维码扫描和应用跳转   序言 前面我们已经调到过怎么制作二维码,在我们能够生成二维码之后,如何对二维码进行扫描呢? 在iOS7之前,大部分应用中使用的二维码扫描是第三方的扫描框架,例如Z ...

  2. iOS开发UI篇—IOS开发中Xcode的一些使用技巧

    iOS开发UI篇—IOS开发中Xcode的一些使用技巧 一.快捷键的使用 经常用到的快捷键如下: 新建 shift + cmd + n     新建项目 cmd + n             新建文 ...

  3. XMPPFrameWork IOS 开发(六)聊天室

    原始地址:XMPPFrameWork IOS 开发(六)聊天室 聊天室 //初始化聊天室 XMPPJID *roomJID = [XMPPJID jidWithString:ROOM_JID]; xm ...

  4. XMPPFrameWork IOS 开发(一)xmpp简介

    原始地址:XMPPFrameWork IOS 开发(一) XMPP : The Extensible Messaging and Presence Protocol 中文全称: 可扩展通讯和表示协议 ...

  5. 【三分钟视频教程】iOS开发中 Xcode 报 apple-o linker 错误的#解决方案#

      [三分钟视频教程]iOS开发中 Xcode 报 apple-o linker 错误的#解决方案#   同样的道理,指向同一库文件的代码语句如果重复书写,即使重复书写所在的文件名字不同,同样会造成这 ...

  6. XMPPFrameWork IOS 开发(四)消息和好友上下线

    原始地址:XMPPFrameWork IOS 开发(四) 消息 //收到消息 - (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XM ...

  7. XMPPFrameWork IOS 开发(三)登录

    原始地址:XMPPFrameWork IOS 开发(三) XMPP中常用对象们: XMPPStream:xmpp基础服务类 XMPPRoster:好友列表类 XMPPRosterCoreDataSto ...

  8. iOS开发MAC下配置svn

    版本控制对于团队合作显得尤为重要,那么如何在iOS开发中进行版本控制呢?在今天的博客中将会介绍如何在MAC下配置SVN服务器,如何导入我们的工程,如何在Xcode中进行工程的checkOut和Comm ...

  9. react native ios 开发,基础配置笔记。

    一.获取硬件信息,使用react-native-device-info插件,配置说明: 1.首先需要安装组件:npm install react-native-device-info --save 2 ...

随机推荐

  1. 解决Collection was modified; enumeration operation may not execute异常

    今天在使用foreach循环遍历list集合时,出现Collection was modified; enumeration operation may not execute.这个错误,查了半天才发 ...

  2. 深入Java虚拟机读书笔记第五章Java虚拟机

    Java虚拟机 Java虚拟机之所以被称之为是虚拟的,就是因为它仅仅是由一个规范来定义的抽象计算机.因此,要运行某个Java程序,首先需要一个符合该规范的具体实现. Java虚拟机的生命周期 一个运行 ...

  3. MOS管(场效应管)导通条件

    场效应管的导通与截止由栅源电压来控制,对于增强型场效应管来说,N沟道的管子加正向电压即导通,P沟道的管子则加反向电压.一般2V-4V就可以了.    但是,场效应管分为增强型(常开型)和耗尽型(常闭型 ...

  4. php获取https下的内容

    直接用file_get_contents,会报错: $url = ('https://xxx.com"); file_get_contents($url); 错误: Warning: fil ...

  5. Android Toast和Notification

    1. Toast用法 Toast 可以设置:时间,位置,自定义View 1.1 最普通的Toast Toast.makeText(ToastActivity.this, "CarloZ Sh ...

  6. Python开发【第一章】:Python简介和入门

    Python简介 Python的创始人为Guido van Rossum.1989年圣诞节期间,在阿姆斯特丹,Guido为了打发圣诞节的无趣,决心开发一个新的脚本解释程序,做为ABC 语言的一种继承. ...

  7. 同步异步GET和POST请求

    1.同步请求可以从因特网请求数据,一旦发送同步请求,程序将停止用户交互,直至服务器返回数据完成,才可以进行下一步操作, 2.异步请求不会阻塞主线程,而会建立一个新的线程来操作,用户发出异步请求后,依然 ...

  8. PHP框架、库和软件资源大全(整理篇)

    php的资料 https://github.com/ziadoz/awesome-php Awesome PHP A curated list of amazingly awesome PHP lib ...

  9. BZOJ 1185 最小矩形覆盖

    Description Input Output Sample Input Sample Output HINT 其实这题就是一道旋转卡壳的裸题,但是我的精度萎了.直接上hzwer的代码吧... #i ...

  10. Truck History(poj 1789)

    Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for v ...