Up to date instructions on how to install XMPPFramework manually?

本小妞迷上赌 提交于 2019-11-28 17:39:15
Future2020

At the XMPPFramework gitHub wiki 1 there is a step by step instruction that helps setting up XMPPFramework for your project.

In fact the error you have mentioned is close to what is also indicated by the instructions.

"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."

I hope this gives you enough information to solve this issue you are facing, even though the instructions are not targeted specifically to iOS-5.

The wiki on github is out of date. Here is how I installed XMPPFramework manually.

Step 1

Clone the XMPPFramework repository to somewhere on your machine and drag the needed folders in somewhere/XMPPFramework to your Xcode project.

The necessary folders are:

  • Vendor/CocoaAsyncSocket
  • Vendor/CocoaLumberjack
  • Vendor/KissXML
  • Vendor/libidn
  • Authentication
  • Categories
  • Core
  • Utilities

You may also need Extensions, it's optional though.

It's important to select the checkbox/radio buttons exactly like this image when dragging folders to your Xcode:

Step 2

a) Drag Sample_XMPPFramework.h to your Xcode and select the checkbox/radio buttons like step 1

b) rename it to XMPPFramework.h

c) customize the content of XMPPFramework.h based on your needs. (I didn't change anything)

The file structure should look like this in Xcode project navigator after doing step 1 and 2:

Step 3

link following frameworks and libraries

  • CFNetwork.framework
  • Security.framework
  • libxml2.dylib
  • libresolv.dylib
  • libidn.a

Step 4

Added these 2 lines to Build Settings:

  • other linker flags = -lxml2

  • HEADER SEARCH PATHS = /usr/include/libxml2

You should be good after these 4 steps. However, please notice that you usually need to #import <UIKit/UIKit.h> before using XMPPFramework

Additional information related to the instructions in @Brian's answer.

Addition to Step 3:
If a lib file such as libxml2.dylib is not available in the "Choose frameworks and libraries to add" window, follow these steps to find it:

  1. Click Add Other...
  2. In the file selection window, COMMAND+SHIFT+G (Go to folder)
  3. Type /usr/lib and then Enter or click Go
  4. Select the .dylib file you need and click Open

After Step 4:
Also note that XMPPFramework and its dependencies use ARC. If your app primarily uses MRR instead of ARC, either convert your app to ARC or perform step 5.

Step 5

Add -fobjc-arc compiler flag to the XMPPFramework files.

In Xcode, for each target that will use XMPPFramework,

  • Go to the target's settings
  • Go to Build Phases
  • Expand Compile Sources
  • Select all the XMPPFramework-related files in the list
  • Press Enter to open the edit window for compilers flags
  • Type -fobjc-arc
  • Enter again to save the change.

The Compile Sources list is unsorted, so it is helpful to use the search field to filter the list on XMPP and then on XEP. That finds most of the files, but there are still some that have to be picked out from the full list of files.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!