Q:

iPhone : Unable to send Tweets using Twitter+OAuth

I am using Twitter+OAuth in my app.
But I am getting following error in my NSLog.
  Request E0B47D37-CE8C-406A-867E-2133E2469397 failed with error Error Domain=HTTP Code=401 "The operation couldn’t be completed. (HTTP error 401.)"

Coding : .h file
 #import "SA_OAuthTwitterEngine.h"
 #import "SA_OAuthTwitterController.h"

 @interface FirstViewController: UIViewController <SA_OAuthTwitterControllerDelegate,SA_OAuthTwitterEngineDelegate> 
 {
 SA_OAuthTwitterEngine *_engine;    
 }

Coding in : .m file 
#define kOAuthConsumerKey  @"consumer_key"
#define kOAuthConsumerSecret @"consumer_secrect"

-(void)viewWillAppear:(BOOL)animated
 {

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

-(IBAction) buttonPressed
{
  if(![_engine isAuthorized])
        {
            UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];

           if(controller)
            {
              [self presentModalViewController:controller animated:YES];
            }
        }
        else
        {
            NSLog(@"twitter msg : %@",twitterMessage);
            [_engine sendUpdate:twitterMessage];

               UIAlertView *alert  = [[UIAlertView alloc] initWithTitle:@"Twitter" message:@"Post Successful" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
            [alert release];
        }

  }
}

 #pragma mark SA_OAuthTwitterEngineDelegate

  -(void) storedCachedTwitterOAuthData: (NSString *)data forUsername: (NSString *)username
  {
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:data forKey:@"authData"];
        [defaults synchronize];
  }

  -(NSString *) cachedTwitterOAuthDataForUsername: (NSString *)username
  {
        return [[NSUserDefaults standardUserDefaults] objectForKey:@"authData"];
  }

   #pragma mark TwitterEngineDelegate

   -(void) requestSucceeded: (NSString *) requestIdentifier
   {
        NSLog(@"Request %@ succeeded", requestIdentifier);
   }

   -(void)requestFailed: (NSString *) requestIdentifier withError:(NSError *)error
    {

        NSLog(@"Request %@ failed with error %@",requestIdentifier,error);
    }

What could be problem ?

A:

Generating new cosumerKey and secretKey may solve your problem.And sometimes server at twitter may also don't respond so twit may not post

