Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6052571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:56:35+00:00 2026-05-23T07:56:35+00:00

MGTwitterEngine.m – (NSString *)username { return [[_username retain] autorelease]; } – (NSString *)password {

  • 0

MGTwitterEngine.m

- (NSString *)username
{
return [[_username retain] autorelease];
}


- (NSString *)password
{
return [[_password retain] autorelease];
}


- (void)setUsername:(NSString *)newUsername password:(NSString *)newPassword
{


// Set new credentials.


   [_username release];

_username = [newUsername retain];

    [_password release];


_password = [newPassword retain];


if ([self clearsCookies]) {

    // Remove all cookies for twitter, to ensure next connection uses new credentials.

    NSString *urlString = [NSString stringWithFormat:@"%@://%@", 
                           (_secureConnection) ? @"https" : @"http", 
                           _APIDomain];

    NSURL *url = [NSURL URLWithString:urlString];

    NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    NSEnumerator *enumerator = [[cookieStorage cookiesForURL:url] objectEnumerator];
    NSHTTPCookie *cookie = nil;
    while (cookie == [enumerator nextObject]) {
        [cookieStorage deleteCookie:cookie];
    }
}
}

- (NSString *)sendUpdate:(NSString *)status
{
return [self sendUpdate:status inReplyTo:0];
}


- (NSString *)sendUpdate:(NSString *)status inReplyTo:(unsigned long)updateID
{
if (!status) {
    return nil;
}

NSString *path = [NSString stringWithFormat:@"statuses/update.%@", API_FORMAT];


NSString *trimmedText = status;

if ([trimmedText length] > MAX_MESSAGE_LENGTH) {


    trimmedText = [trimmedText substringToIndex:MAX_MESSAGE_LENGTH];

}

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];

[params setObject:trimmedText forKey:@"status"];

if (updateID > 0) {

    [params setObject:[NSString stringWithFormat:@"%u", updateID] forKey:@"in_reply_to_status_id"];

}

NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];


return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path 
                    queryParameters:params body:body 
                        requestType:MGTwitterUpdateSendRequest
                       responseType:MGTwitterStatus];


}

TwitterPostViewController.m

- (IBAction)submitTweet{

[tweet resignFirstResponder];

if([[tweet text] length] > 0){


    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"TwitterUsername"]);

    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"TwitterPassword"]);       


    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

    [engine sendUpdate:[tweet text]];

}

}



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

NSLog(@"Fail: %@", error);

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

UIAlertView *failAlert;

if([error code] == 401){

    failAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Incorrect Username & Password." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [failAlert setTag:10];

    [failAlert setDelegate:self];

} 
else 
{

    failAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Failed sending status to Twitter." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

}

[failAlert show];

[failAlert release];

}

It shows me the fail popup of Incorrect username and password

I have checked through nslog that username and password are going correct.
what could be wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:56:36+00:00Added an answer on May 23, 2026 at 7:56 am

    It looks like the version of MGTwitterEngine you’re using is trying to use basic auth. That was switched off in Twitter in favour of OAuth. Get a newer version of MGTwitterEngine (or a fork that supports OAuth).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MGTwitterEngine library for my iOS app to post tweets. NSString *username =
I'm using MGTwitterEngine to grab profiles from an NSString but I only get the
this is the MGTwitterEngine page code ! but how can i download it ?
Trying to get MGTwitterEngine app to build. Getting one pesky error. The following ERROR.
I'm using MGTwitterEngine to add Twitter functionality to my app. It's very easy to
I'm trying to get MGTwitterEngine to work for the iPhone SDK. I've followed the
How to do a RETWEET on an iPhone twitter app (MGTwitterEngine)
I'm using MGTwitterEngine in my project and when compiling the whole project I get
Incompatible pointer types assigning to NSObject *__weak from NSObject When using MGTwitterEngine I get
I'm using a version of Matt Gemmell's MGTwitterEngine, and I'm trying to get some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.