xmpp之配置Xcode(1)
介绍
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
原文:
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)的更多相关文章
- (转)xmpp 环境配置-支持扩展
第一种方法直接拖 1> 拖入文件夹 在网盘链接的xmppFramework文件夹 :http://pan.baidu.com/s/1jGxLa3G 也可以直接去github搜索下载. 2> ...
- Apple Watch 1.0 开发介绍 1.2 简介 配置Xcode工程
WatchKit app需要一个现有的iOS app.在iOS app工程中,添加一个新的WatchKit app target,它包含了WatchKit app和WatchKit extension ...
- 配置Xcode的Device Orientation、AppIcon、LaunchImage
以下图片指出的 TARGETS→General 面板的信息. 下面我们讲讲根据 APP 需求配置我们的Xcode: 1.设置 Device Orientation,指定 APP 支持设备的方向 ,我们 ...
- xmpp 环境配置
XMPP框架地址:http://xmpp.org/xmpp-software/libraries/ 配置流程
- 配置Xcode版本控制SVN详细步骤内含解决Xcode/Mac OS10.8无法配置SVN的解决方法
本站文章均为李华明Himi原创,转载务必在明显处注明:(作者新浪微博:@李华明Himi ) 转载自[黑米GameDev街区] 原文链接: http://www.himigame.com/game-de ...
- prefix pct文件配置Xcode
1.查看项目的各个文件夹下的文件名称: 2.配置如下图:需要添加$(SRCROOT)/项目的名称/pch所在文件夹路径 .易于理解方便那些初学者,下载别人的demO运行时遇到这样的类似的问题噢.< ...
- MAC配置Xcode的Cocos2d-x环境
Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:00000099 EndFragment:00003988 1.Mac配置环境变量,即编辑命令: o ...
- XMPP开发环境配置
首先配置XMPP开发环境配置需要的软件 先安装xampp-osx-1.8.3-5-installer.dmg 安装成功后launchpad里会多出一个XAMPP(其他),点开里面的manager-os ...
- C连接MySQL数据库开发之Xcode环境配置及测试
一.开发环境 Mac OS X 10.9.2 64位.Xcode5.1.MySQL5.5.37 64位 MySQL安装目录为:/usr/local/mysql 二.配置xcode连接mysql的编译选 ...
随机推荐
- Dll,OCX控件的注册(转)
原文地址:http://home.51.com/heiyijiushi/diary/item/10053693.html C#自动实现Dll(OCX)控件注册的两种方法2012-07-31 21:20 ...
- bzoj2989
坐标轴转化+cdq分治 我们发现那个绝对值不太好搞,于是我们把曼哈顿距离转为切比雪夫距离,x'=x-y,y'=x+y,这样两点之间距离就是max(|x1'-x2'|,|y1'-y2'|),这个距离要小 ...
- SQL Server2012 T-SQL基础教程--读书笔记(1-4章)
SQL Server2012 T-SQL基础教程--读书笔记(1-4章) SqlServer T-SQL 示例数据库:点我 Chapter 01 T-SQL 查询和编程背景 1.3 创建表和定义数据的 ...
- sql数据库如何在数据库里面把其中一个数据库的表复制到另一个数据库里面
在sqlserver数据库里面,我们肯定有这样一个情况,假如我用的是SQL2008,如何把数据库里面的整个表以及表内数据复制到另外一个表中.那应该如何操作??有两种方法,我们一起来看一下 复制表结构: ...
- PCB .NET Reactor 加密工具(NecroBit加密技术)
在PCB行业中,我们使用的软件或脚本绝大多数都用非编译型语言写程序,而从一开始选择这种编程语言,就注定了程序的源码有被曝露风险.我们PCB工程系统用.NET语言编写,C#编译后会被转换为IL代码的中间 ...
- conda命令不能用的问题
在Windows下安装了Anaconda3-5.0.1-Windows-x86.exe 但是在cmd端下,打命令conda没反应 打pip显示如下错误 这是由于cmd编码为gbk的问题导致的 解决方案 ...
- bzoj 1628: [Usaco2007 Demo]City skyline【贪心+单调栈】
还以为是dp呢 首先默认答案是n 对于一个影子,如果前边的影子比它高则可以归进前面的影子,高处的一段单算: 和他一样高的话就不用单算了,ans--: 否则入栈 #include<iostream ...
- SSH协议、HTTPS中SSL协议的完整交互过程
1.(SSH)公私钥认证原理 服务器建立公钥:每一次启动sshd服务时,该服务会主动去找/etc/ssh/ssh_host*的文件 客户端通过ssh工具进行连接,如Xshell,SecureCRT 服 ...
- Spring Boot (28) actuator与spring-boot-admin
在上一篇中,通过restful api的方式查看信息过于繁琐,也不直观,效率低下.当服务过多的时候看起来就过于麻烦,每个服务都需要调用不同的接口来查看监控信息. SBA SBA全称spring boo ...
- java邮件发送工具
最近在web项目中,客户端注册时需要通过邮箱验证,服务器就需要向客户端发送邮件,我把发送邮件的细节进行了简易的封装: 在maven中需要导入: <!--Email--> <depen ...