DX89B
DX89B

Reputation: 1633

How to send direct message with Twitter?

in my iphone application i have to send direct message throughout twitter, the problem is that twitter had changed the authentication from basic authentication to oauth and tutorial on the Web are out of date

so i use SAOauthTwitterEngine for the authentication part and all ok. but these classes don't use the api, so i have to use MGTwitterEngine for this.

the problem is that MGTE dont have oauth but only xauth and basic authentication, and i cant use this together anyone know how to do it? or know a tutorial that explain it.

thanks a lot.

Upvotes: 0

Views: 3674

Answers (2)

Vinod Jat
Vinod Jat

Reputation: 1374

in my app I am sending direct messages to my twitter followers by using MGTwitterEngine let have a look:

appDelegate._engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
appDelegate._engine.consumerKey = kOAuthConsumerKey;
appDelegate._engine.consumerSecret = kOAuthConsumerSecret;

once you get authenticated this method get called

    #pragma mark SA_OAuthTwitterControllerDelegate

    - (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *)username {
     NSLog(@"Authenicated for %@", username);
     [appDelegate._engine sendDirectMessage:@"Test for Twitter direct message" to:username];
}

Hope this will help you.

Upvotes: 1

Mark
Mark

Reputation: 1031

i suggest you OAuth because xAuth requires you to send an email to twitter askeing them to give you the permission, and you have to write a reort on your application (this isn't good for a testing app) have you tried this? https://github.com/bengottlieb/Twitter-OAuth-iPhone

Upvotes: 1

Related Questions