介绍

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. 【Dairy】2016.11.5

    橘子洲一游

  2. [Codeforces Round 486A] Fair

    [题目链接] https://codeforces.com/contest/986/problem/A [算法] 用dist(i,j)表示第i种食物运到第j个城市需要的最小代价 将所有特产为第i中食物 ...

  3. python-----删除空文件夹

    问题描述: 有时,我们的文件夹太多了,但有的文件夹还是空的文件夹,自己去删需要好久,于是想着写个脚本自动删除.代码如下: #!/usr/bin/env python # -*- coding: utf ...

  4. 如何精通javascript

    http://stackoverflow.com/questions/2628672/what-should-every-javascript-programmer-know Not jQuery. ...

  5. 在数据库中生成txt文件到网络驱动器中(计算机直接创建的网络驱动器在sql server中没有被找到)

    环境:sql server 2008 一.创建网络驱动器映射 语法:exec master..xp_cmdshell 'net use Z: \\ip地址\网络路径 密码 /user:用户名' 例如: ...

  6. bzoj 3396: [Usaco2009 Jan]Total flow 水流【最大流】

    最大流生动形象的板子,注意数组开大点 #include<iostream> #include<cstdio> #include<queue> #include< ...

  7. 10.16NOIP模拟赛

    /* 我是一个大sb */ #include<iostream> #include<cstdio> #include<cstring> #include<qu ...

  8. service: no such service mysqld 与MySQL的开启,关闭和重启

    1.问题原因与解决办法 因为修改了MySQL临时文件的目录后,使用service mysqld restart重启MySQL出现如下错误: service: no such service mysql ...

  9. 《编写可维护的Javascript》学习总结

    第一部分 一.基本规范 1.缩进:一般以四个空格为一个缩进. 2.语句结尾:最好加上分号,因为虽然“自动分号插入(ASI)”机制在没有分号的位置会插入分号,但是ASI规则复杂而且会有特殊情况发生 // ...

  10. 浅谈.net remoting 与 webservice

    1. .NET Remoting .NET Remoting是微软随.NET推出的一种分布式应用解决方案,被誉为管理应用程序域之间的 RPC 的首选技,它允许不同应用程序域之间进行通信(这里的通信可以 ...