zoukankan      html  css  js  c++  java
  • 【iOS XMPP】使用XMPPFramewok(一):添加XMPPFramework(XCode 4.6.2)

    转自:http://www.cnblogs.com/dyingbleed/archive/2013/05/09/3069145.html

    XMPPFramework

    GitHub: https://github.com/robbiehanson/XMPPFramework

    获取源代码

    git clone https://github.com/robbiehanson/XMPPFramework.git

    checkout XMPPFramework 一个最新的 branch

    添加依赖

    > 拷贝 <XMPPFramework>/Vendor/CocoaLumberjack 到项目根目录下,add files...,选择 CocoaLumberjack 文件夹

    > 同样的步骤,拷贝 CocoaAsyncSocket 和 KissXML 并添加到项目中

    CocoaAsyncSocket 依赖 CFNetwork.framework 和 Security.framework,在 TARGETS -> Build Phases -> Link Binary With Libraries 添加

    KissXML 使用了 libxml2 解析 XML,所以

    首先,我们需要在 TARGETS -> Build Phases -> Link Binary With Libraries 添加 libXML2.dylib

    然后,在 TARGETS -> Build Settings -> Other Linker Flags 添加 -lxml2,TARGETS -> Build Settings -> Header Search Paths 添加 /usr/include/libxml2

    > 拷贝 <XMPPFramework>/Vendor/libidn 到项目根目录下,添加静态库文件 libidn.a 和头文件 idn-int.h 和 stringprep.h

    添加 XMPPFramework

    拷贝源码目录下的 Authentication Categories Core 和 Utilities 到项目根目录下并添加到项目中

    此外,需要添加动态连接库 libresolv.dylib ,在 TARGETS -> Build Phases -> Link Binary With Libraries 添加

    添加扩展

    你可以根据自己的需要,添加 <XMPPFramework>/Extensions 的扩展到项目中 

    你可能遇到的问题:

    > "XMPPFramework.h" file not found

    XMPPFramework.h 内容如下,可根据实际使用模块进行删改:

    复制代码
    #import "XMPP.h"
    
    // List the modules you're using here.
    
    #import "XMPPReconnect.h"
    
    #import "XMPPRoster.h"
    #import "XMPPRosterCoreDataStorage.h"
    
    #import "XMPPvCardTempModule.h"
    #import "XMPPvCardAvatarModule.h"
    #import "XMPPvCardCoreDataStorage.h"
    
    #import "XMPPCapabilities.h"
    #import "XMPPCapabilitiesCoreDataStorage.h"
    
    #import "XMPPMUC.h"
    #import "XMPPRoomCoreDataStorage.h"
    复制代码

    还有一些问题,是由于没有添加Extension需要的依赖库所产生的

    可在 TARGETS -> Build Phases -> Link Binary With Libraries 添加

    CoreData.framework SystemConfiguration.framework CoreLocation.framework

    ARC 警告

    XMPPFramework 使用 ARC,如果你的项目没有使用 ARC,build 之后你会得到许许多多的 ARC 警告。

    不要忽视这些警告,它会导致你的程序因 memory leak 而崩溃……

    Edit -> Refactor -> convert to Objective-C ARC,消灭这些警告!

    参考: https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_iOS

    Android 开发讨论群:84778336 
    iOS 开发讨论群:82873648 

    知识共享许可协议
    本作品采用知识共享署名-非商业性使用 3.0 许可协议进行许可。
    转载请署名李震(博客地址:http://www.cnblogs.com/dyingbleed/),且不得用于商业目的。
  • 相关阅读:
    ABAP学习(10):ALV显示之function alv
    ABAP学习(11):ALV显示之OO ALV使用示例
    ABAP学习(3):屏幕显示
    ABAP学习(6):ABAP GUI和开发工具
    ABAP学习(9):时间日期操作
    ABAP学习(8):操作EXCEL
    ABAP学习(2):控制语句
    ABAP学习(5):数据库语句
    ABAP学习(4):内表
    编程经验:高性能.NET WEB开发(1)http压缩
  • 原文地址:https://www.cnblogs.com/wangpei/p/4126540.html
Copyright © 2011-2022 走看看