views:

2249

answers:

7

Anyone want to share an Xcode project that has MGTwitterEngine in it? Mine won't compile. Are there certain project settings to set? I just made a stock tab bar app for iPhone and added the MGTwitterEngine files. Tons of compiler errors. What am I missing?

A: 

You're probably missing the libxml library. You need to add that to your linked frameworks. Here's a question that has a little more information, but that's the gist of it.

http://stackoverflow.com/questions/842292/best-approach-for-xml-parsing-on-the-iphone

Ben Gottlieb
I did add the libxml2.2dylib file to the project and I put "usr/lib/libxml2.2.dylib" in for a header search path. I noticed there are whole other sets of these libs for the different platform/SDKs I have. I'm currently set for the iPhone Simulator platform and the iPhoneOS3.0 SDK. I assume that doesn't matter. The first error message in the list is: /MGTwitterLibXMLParser.h:10:30: error: libxml/xmlreader.h: No such file or directory
Troy Sartain
you should add libxml2.dylib, rather than 2.2. How are you adding it? You should use Target -> Info -> General -> "+" button. That should add it for all architectures. When adding the header file, be sure to check the "Recursive" checkbox.
Ben Gottlieb
A: 

You also need to add

  • libxml to Header Search Path ( should be something like /usr/library/libxml2 )
Surya
You shouldn't need to add -lxml2 to the compiler flags, since you're adding the library. But definitely the header files path.
Ben Gottlieb
I was hoping that was it but I actually had added libxml2.2dylib already. When I click on the "165 errors" indicator at the bottom right after compiling, the first error reported is:..- (void)imageReceived:(NSImage *)image forRequest:(NSString *)connectionIdentifierThe error message is "error: expected ')' before 'NSImage'"
Troy Sartain
Did you add the lib to header search paths ?
Surya
@Ben yea ..you are right
Surya
Yeah, but maybe I did it wrong. I just put in "/usr/library/libxml2.2" (and versions thereof) in for a header path in the Project Settings.
Troy Sartain
thats wierd ..i will share my project once i get home
Surya
A: 

I managed to get the library path right eventually. However, in the end, I got rid of the whole MGTwitterEngine thing and went with the TwitterHelper stuff that I noticed the folks from the Stanford iPhone class using. It uses the synchronous calls and it's not as full-featured. But it's lighter and I understand it better. I just use threading to counter the synchronicity. (Hey, wasn't that a song?!) Anyway, a little JSON code and it's all under control. Most of you are probably going to think I'm a noob but it just feels cleaner and easier to handle. I know there are plenty of good reasons to use MGTwitterEngine.

Bottom line is, even though I got it to work by getting the library path right, I don't even need to worry about any paths by adding the very small TwitterHelper stuff to my project. Seems more Mac-like than to have to go into too much tinkering (I can already hear the experts saying that setting paths is not too much but I absolutely detest the Project Settings dialog.)

Troy Sartain
+1  A: 

I had same problem. To get it to compile I added "$SDKROOT/usr/include/libxml2" to the Header Search Paths list. I also checked Recursive checkbox.

Asa
A: 

All you need is explain here MGTwitter with yajl for iPhone

Gonzo Oin
A: 

Make sure that you're adding "$SDKROOT/usr/include/libxml2" to header search paths in your Target settings and not just the Project.

Uberhamster
Thanks, I think I had something close to that at one point. Anyway it worked eventually.
Troy Sartain
A: 

hey try this link it explains everything properly and in my case it works great!!!!!!!

link text

SWATI