介绍

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.

xmpp之配置Xcode(1)的更多相关文章

  1. (转)xmpp 环境配置-支持扩展

    第一种方法直接拖 1> 拖入文件夹 在网盘链接的xmppFramework文件夹 :http://pan.baidu.com/s/1jGxLa3G 也可以直接去github搜索下载. 2> ...

  2. Apple Watch 1.0 开发介绍 1.2 简介 配置Xcode工程

    WatchKit app需要一个现有的iOS app.在iOS app工程中,添加一个新的WatchKit app target,它包含了WatchKit app和WatchKit extension ...

  3. 配置Xcode的Device Orientation、AppIcon、LaunchImage

    以下图片指出的 TARGETS→General 面板的信息. 下面我们讲讲根据 APP 需求配置我们的Xcode: 1.设置 Device Orientation,指定 APP 支持设备的方向 ,我们 ...

  4. xmpp 环境配置

    XMPP框架地址:http://xmpp.org/xmpp-software/libraries/ 配置流程

  5. 配置Xcode版本控制SVN详细步骤内含解决Xcode/Mac OS10.8无法配置SVN的解决方法

    本站文章均为李华明Himi原创,转载务必在明显处注明:(作者新浪微博:@李华明Himi ) 转载自[黑米GameDev街区] 原文链接: http://www.himigame.com/game-de ...

  6. prefix pct文件配置Xcode

    1.查看项目的各个文件夹下的文件名称: 2.配置如下图:需要添加$(SRCROOT)/项目的名称/pch所在文件夹路径 .易于理解方便那些初学者,下载别人的demO运行时遇到这样的类似的问题噢.< ...

  7. MAC配置Xcode的Cocos2d-x环境

    Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:00000099 EndFragment:00003988 1.Mac配置环境变量,即编辑命令: o ...

  8. XMPP开发环境配置

    首先配置XMPP开发环境配置需要的软件 先安装xampp-osx-1.8.3-5-installer.dmg 安装成功后launchpad里会多出一个XAMPP(其他),点开里面的manager-os ...

  9. C连接MySQL数据库开发之Xcode环境配置及测试

    一.开发环境 Mac OS X 10.9.2 64位.Xcode5.1.MySQL5.5.37 64位 MySQL安装目录为:/usr/local/mysql 二.配置xcode连接mysql的编译选 ...

随机推荐

  1. 嵌入式Linux系统---ppp拨号,4G模块上网【转】

    本文转载自:http://blog.csdn.net/qq562029186/article/details/65438553 4G模块PPP拨号上网 方法1 所需文件: xxx-chat-conne ...

  2. Chrome查看JavaScript函数

    在页面上右键view page source(Ctrl+U),然后在弹出来的界面可以查找JavaScript函数 注意:这个只能看到内嵌在网页上的JavaScript函数 一般来讲,JavaScrip ...

  3. 编程细节 —— 按值传递、按引用传递(final、const)

    System.out,out 是 System 类内定义的静态 final PrinterStream 变量: public final class System { ... public final ...

  4. js工作备注

    { field : 'state', title : '事件状态', align: 'center', width : 120, formatter : function(value, row, in ...

  5. array_column() 函数[二维数组转为一维数组]

    array_column() 函数 输出数组中某个键值的集合[二维数组转为一位数组] <?php // 表示由数据库返回的可能记录集的数组 $a = array( array( 'id' =&g ...

  6. web界面bug-临时

    一.登录页面 二.首页 三.项目 四.项目池 五.专家管理 六.审批 七.日/周报 八.设置

  7. Lightoj 1010 - Knights in Chessboard (胡搞)

    题目连接: http://www.lightoj.com/volume_showproblem.php?problem=1010 题目描述: 有一个n*m的棋盘,根据象棋中马走日字的规则,问此棋盘最多 ...

  8. Snackbar:用它来替换Toast 显示短提示

    简介 Snackbar 它是Toast的子类.主要用来提示短暂的提示信息后,然后它自动消失. 它寄生在普通view上,具有一些基本功能. 它寄生在 CoordinatorLayout 时,有以下两个特 ...

  9. 273 Integer to English Words 整数转换英文表示

    将非负整数转换为其对应的英文表示,给定的输入是保证小于 231 - 1 的.示例:123 -> "One Hundred Twenty Three"12345 -> & ...

  10. Kafka~消费的有效期

    消息的过期时间 我们在使用Kafka存储消息时,如果已经消费过了,再永久存储是一种资源的浪费,所有,kafka为我们提供了消息文件的过期策略,可以通过配置server.properies来实现# vi ...