[twitter-dev] Re: Need help with MGTwitterEngine OAuth/xAuth

2010-08-31 Thread metawops
P.S.: Here's a link to the Xcode project with the little test program:
http://dl.dropbox.com/u/3748223/MGTEtest.zip

On 31 Aug., 00:13, metawops metaw...@googlemail.com wrote:
 Hi everyone,

 I’m struggling with MGTwitterEngine  OAuth/xAuth here with my Mac OS
 X application.
 The problem is that I get either SIGTRM or EXC_BAD_ACCESS crashes from
 the call of the getXAuthAccessTokenForUsername method. And I just
 don’t know what I’m doing wrong!

 Here’s the (stripped) code of a very simple demo app, basically. Just
 one window with a username  password textfield and a button to start
 the action:

 -(IBAction)pushLogin:(id)sender
 {
   NSString *username = [NSString stringWithString:[tfUsername
 stringValue]];
   NSString *password = [NSString stringWithString:[tfPassword
 stringValue]];
   if ([username isEqualToString:@] || [password
 isEqualToString:@]) {
     // at least one of the text fields was empty!
     [tfInfo setStringValue:@Please supply a username and a
 password!];
   }
   else {
     NSString *xAuthAccessToken = [[[NSString alloc] init]
 autorelease];
     // program crashes at the following line
     xAuthAccessToken = [twitterEngine
 getXAuthAccessTokenForUsername:username password:password];
     [tfInfo setStringValue:xAuthAccessToken];
   }

 }

 #pragma mark MGTwitterEngine delegate methods
 - (void)accessTokenReceived:(OAToken *)token forRequest:(NSString
 *)connectionIdentifier
 {
   [twitterEngine setAccessToken:token];
   [tfInfo setStringValue:@accessTokenReceived!];

 }

 
 Additionally, I set my consumer key  secret in my init method:

 - (id) init
 {
   self = [super init];
   if (self != nil) {
     twitterEngine = [MGTwitterEngine twitterEngineWithDelegate:self];
     NSString *consumerKey = @”123…”;
     NSString *consumerSecret = @”123456…”;
     [twitterEngine setConsumerKey:consumerKey secret:consumerSecret];
   }
   return self;

 }

 Does anyone has any advice? What am I missing?
 (Checked out the latest revisions of MGTwitterEngine  OAuthConsumer.
 Is there any Cocoa alternative to MGTwitterEngine that supports OAuth/
 xAuth?)

 Thank you so much!
 Stefan.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en


[twitter-dev] Re: Need help with MGTwitterEngine OAuth/xAuth

2010-08-31 Thread Felix
Hi,

1. Replace
twitterEngine = [[MGTwitterEngine twitterEngineWithDelegate:self];
with
twitterEngine = [[[MGTwitterEngine twitterEngineWithDelegate:self]
retain];
in init of the TestControllers.

2. build the 32-bit version. 64-bit seems not to be supported.

best regards, Felix.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en


[twitter-dev] Re: Need help with MGTwitterEngine OAuth/xAuth

2010-08-31 Thread metawops
Hi Felix,

thanks so much! Works now!! :-))

Have to read (even) more about memory management in Objective-C!
But never would have found out about the 64bit vs. 32bit issue I
think.
So thanks for pointing that out!!

Stefan.

On Aug 31, 11:35 am, Felix heidr...@enervision.de wrote:
 Hi,

 1. Replace
 twitterEngine = [[MGTwitterEngine twitterEngineWithDelegate:self];
 with
 twitterEngine = [[[MGTwitterEngine twitterEngineWithDelegate:self]
 retain];
 in init of the TestControllers.

 2. build the 32-bit version. 64-bit seems not to be supported.

 best regards, Felix.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en