开发者

How can I compile MGTwitterEngine using the OAuthConsumer framework?

开发者 https://www.devze.com 2023-02-27 01:16 出处:网络
I\'ve followed the instructions at http://damienh.org/2009/06/20/setting-up-mgtwitterengine-with-yajl-106-for-iphone-development/ to try and get a copy of MGTwitterEngine compiling in XCode.

I've followed the instructions at http://damienh.org/2009/06/20/setting-up-mgtwitterengine-with-yajl-106-for-iphone-development/ to try and get a copy of MGTwitterEngine compiling in XCode.

I have YAJL installed as a framework and OAuthConsumer as a framework in the project. When I try and build my project I get the following errors:

Ld build/Debug-iphonesimulator/UFrame.app/UFrame normal i386
cd /Users/twhume/Documents/Projects/UFrame
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/twhume/Documents/Projects/UFrame/build/Debug-iphonesimulator -L/Users/twhume/Documents/Projects/UFrame -F/Users/twhume/Documents/Projects/UFrame/build/Debug-iphonesimulator -F/Users/twhume/Documents/Projects/UFrame -F/Users/twhume/Documents/Projects/UFrame/../../../Desktop/tmp/obj-c/OAuthConsumer/build/Release -filelist /Users/twhume/Documents/Projects/UFrame/build/UFrame.build/Debug-iphonesimulator/UFrame.build/Objects-normal/i386/UFrame.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework YAJLiOS -lxml2 -framework OAuthConsumer -o /Users/twhume/Documents/Projects/UFrame/build/Debug-iphonesimulator/UFrame.app/UFrame

Undefined symbols:
  "_OBJC_CLASS_$_OAConsumer", referenced from:
      objc-class-ref-to-OAConsumer in MGTwitterEngine.o
  "_OBJC_CLASS_$_OAToken", referenced from:
      objc-class-ref-to-OAToken in MGTwitterEngine.o
  "_OBJC_CLASS_$_OAMutableURLRequest", referenced from:
      objc-class-ref-to-OAMutableURLRequest in MGTwitterEngine.o
  "_OBJC_CLASS_$_OARequestParameter", referenced from:
      objc-class-ref-t开发者_StackOverflowo-OARequestParameter in MGTwitterEngine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I'm relatively new to Xcode, but this looks to me like a linking error: that the OAuth libraries aren't being included somehow. But I'm not sure exactly what's going on here, and googling around for an answer hasn't helped. I suspect the issue might be my unfamiliarity with Xcode rather than anything else.

I've also tried downloading and building the OAuthConsumer framework from scratch, and including that (instead of including the version bundled with the MGTwitterEngine source code). It made no difference. I've cleaned, rebuilt, and so on. I've also ensured that libxml2.dylib is included in the "Link Binary With Libraries" group under the target for my project.

Any ideas on how to solve this?


Try using jdg's iPhone-ready OAuthConsumer instead of the plain Mac-ready one on code.google.com

This is provided as a set of files rather than a framework (frameworks can be tricky for the iPhone as XCode does cross-compiling).

You should be able to use the latest MGTwitterEngine without making the changes to MGTwitterYAJLParser.m that damien proposed -- and use gabriel's YAJL as he points out, but you can again include the source in your project.

Good luck!

Adam


I followed Adam's advice and one minor edit I had to make to finally get this working was to change the following source from requestParameterWithName to requestParameter

    [request setParameters:[NSArray arrayWithObjects:
    [OARequestParameter requestParameterWithName:@"x_auth_mode" value:@"client_auth"],
    [OARequestParameter requestParameterWithName:@"x_auth_username" value:username],
    [OARequestParameter requestParameterWithName:@"x_auth_password" value:password],nil]];


This fixed my problem. I just want to let people know in advance who do intend to use this library to fix the typos in OAAttachment.m/.h (the filename is OAAtachment.m/.h), as well as the fileName instance variable in said files (the variable is named filename).

0

精彩评论

暂无评论...
验证码 换一张
取 消