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的编译选 ...
随机推荐
- 千万数据条 用户特征数据 写入mysql
from mysql_tool import * import copy s = ''' INSERT INTO `qqzone`.`myu` (`id`, `uid`, `age`, `gender ...
- PHP MySQL mysql.sock的问题
SQLSTATE[HY000] [2002] No such file or directory 原因是找不到mysql.sock这个文件..一般出现的症状就是能用ip连接mysql.但不能使用loc ...
- Swing的Look And Feel机制研究
首先,参考了一下这篇文章 里面提到需要自己Override L&F的initClassDefaults方法,但是查看了一下NimbusLookAndFeel, 发现它为了没有实现initCla ...
- 玲珑学院OJ 1028 - Bob and Alice are playing numbers 字典树,dp
http://www.ifrog.cc/acm/problem/1028 题解处:http://www.ifrog.cc/acm/solution/4 #include <cstdio> ...
- mysql将查询结果导出csv文件的方法into outfile
例句: select * from table_name into outfile '/tmp/tmp.csv' fields terminated by ','; 详解: ① into outf ...
- 4.7.6 Compaction of LR Parsing Tables
4.7.6 Compaction of LR Parsing Tables A typical programming language grammar with 50 to 100 terminal ...
- bzoj1898 [Zjoi2005]Swamp 沼泽鳄鱼——矩阵快速幂
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1898 求到达方案数...还是矩阵快速幂: 能够到达就把邻接矩阵那里赋成1,有鳄鱼的地方从各处 ...
- python调用java程序--jpype
官方网站:http://jpype.sourceforge.net/ 官方使用文档:http://jpype.sourceforge.net/doc/user-guide/userguide.html ...
- 手机访问PC网站自动跳转到手机网站代码
方法一: <script type="text/javascript"> try { var urlhash = window.location.hash; if (! ...
- bzoj 1578: [Usaco2009 Feb]Stock Market 股票市场【背包】
参考:https://blog.csdn.net/mars_ch/article/details/53011234 我背包真是好不熟练啊-- 第一天买了第三天卖相当于第一天买了第二天卖第二天再买第三天 ...