Search code examples
iphonetwitteroauthtwitter-oauthmgtwitterengine

How to post tweet from iPhone without PIN using SA_OAuthTwitterEngine?


I am developing a iPhone application which sends tweets to twitter. For this I am using SA_OAuthTwitterEngine + MGTwitterEngine classes.

I register applicaiton to www.twitter.com/apps and pass Consumer key and Consumer secret to controller my code is this.

if(!_engine){
    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey    = slPcFUjUh5y1hex0zvEhPg;
    _engine.consumerSecret = u6ydovMdP9yeiVqDukVhIzZPgJR9XDPUwfxymzNs;  
}

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];

if (controller){
    [self presentModalViewController: controller animated: YES];
    intTwitterFlag = 1;
}

Previously on twitter.com/apps I select Application type = client and my application will generate PIN and accessToken. But when i change my Application type = Browser it cannot generate PIN and accessToken.

Previously when application type is client i am giving user name and password and then control return to my application from the webview but now after entering user name and password it cannot dismissModalViewController but showing Select and Copy the PIN.

Thank you for your time and any help you can give me!


Solution

  • Its better to use xAuth route for mobile apps

    http://dev.twitter.com/pages/xauth

    check XAuthTwitterEngine which implements xauth for the MGTwitterEngine