14

I'm having a really tough time getting XMPPFramework to work. I've followed every direction written on the net, and XCode is not finding any of my XMPPFramework classes.

Expected specifier-qualifier-list before 'XMPPStream' XMPP.h: No such file or directory XMPPRoster.h: No such file or directory

I have XMPPFramework copied into my project's root directory. Why can't these files be seen? Is there something that I need to do under Header Search Paths or Library Search Paths?

I've set those entries to $(inherited) and $(SRCROOT) and XCode 4.2 auto-fills in my project's root directory and still doesn't find my files.

I'm quite sure that I'm not the only one having this issue, and it is a showstopper. Any ideas?

Brian
  • 30,156
  • 15
  • 86
  • 87
user798719
  • 9,619
  • 25
  • 84
  • 123
  • These instructions from @Brian no longer work, (no) thanks to this commit: https://github.com/robbiehanson/XMPPFramework/commit/5aafcdfd27b6b4403e6e357f5687fabded3362ec If you want to use these instructions, revert this commit and then things will work again. – Joe Oct 29 '15 at 23:27

3 Answers3

38

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:

enter image description here

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:

enter image description here

Step 3

link following frameworks and libraries

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

enter image description here

Step 4

Added these 2 lines to Build Settings:

  • other linker flags = -lxml2 enter image description here
  • HEADER SEARCH PATHS = /usr/include/libxml2 enter image description here

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

Brian
  • 30,156
  • 15
  • 86
  • 87
  • 3
    Thanks for this post, helped a lot. But I have to say this whole process feels so depressing and fragile. – Kevin R Jun 02 '15 at 08:55
  • 1
    The Facebook extension apparently does not work on the iPhone (it does not compile because for some reason it doesn't find one of the dependencies, which is in a project inside of it). I haven't managed to figure out the problem so I just removed the Facebook extension. – Velociround Aug 05 '15 at 17:44
  • When the time I posted this answer, every extension worked properly. Maybe it's a new bug in the new version of this library. – Brian Aug 06 '15 at 04:59
  • As there are lot of coredata models in the framework ..may i know how to update lib+model and how to check the current version of XMPPFramework being used in the code – yasirmturk Aug 17 '15 at 06:23
  • sorry, I don't know, maybe you can open an issue on their repository. – Brian Aug 17 '15 at 06:48
  • I am getting this error in Xcode 7 : [**Module dnssdSimu not found**](https://dl.dropboxusercontent.com/u/97412909/module%20not%20found.png) – Nishant Sep 18 '15 at 12:06
  • I am also getting an error: Module 'libxmlSimu' not found – user3916570 Sep 18 '15 at 15:52
  • @user3916570 Did you found a solution. I am getting the same error. – Shruti Sep 23 '15 at 07:28
  • 1
    use `#import "libxml/tree.h"` instead of **libxmlSimu** – jaskiratjd Sep 30 '15 at 09:40
  • hey guys, do you have any solution for the module not found issue? Please feel free to edit the answer if you got the solution, so more people can be helped. Thanks :D – Brian Nov 27 '15 at 11:36
  • kindly also mention that we need to download the 3 vendor folders seperately, as it doesnt come when we clone the repository – Zain Ullah Muhammad Jan 11 '17 at 13:39
  • @Brian, Can you help me this problem https://stackoverflow.com/questions/44172852/how-to-parse-xmppmessage-element-attribute-and-node-in-xmppframework-with-swif ? – May Phyu May 25 '17 at 08:59
4

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.

jarlh
  • 42,561
  • 8
  • 45
  • 63
Future2020
  • 9,939
  • 1
  • 37
  • 51
  • 1
    Although this is the accepted answer, the post below for Brian is more suitable for Xcode 6. – Alaa Eldin Jun 04 '15 at 09:03
  • @jarlh, bro Can you help me this problem https://stackoverflow.com/questions/44172852/how-to-parse-xmppmessage-element-attribute-and-node-in-xmppframework-with-swif ? – May Phyu May 25 '17 at 08:59
0

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.

jk7
  • 1,958
  • 1
  • 22
  • 31