Search code examples
objective-cioscocoa-touchdelegatesmgtwitterengine

Getting User Details from MGTwitterEngine


I am developing an application which has a Twitter login. I have integrated MGTwitterEngine for that, and everything is working fine.

My problem is that when the user logs in, I need some details -- whatever info is returned by MGTwitterEngine for that logged-in user.

When I had a look in the library docs, I found the below delegate method which might give some user information, but when I log in ,this method never gets called.

- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {

    NSLog(@"User Info Received: %@", userInfo);
}

Can somebody please suggest to me how to get the user's information from MGTwitterEngine or how I should use this method?

_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey = @"PzkZj9g57ah2bcB58mD4Q";
    _engine.consumerSecret = @"OvogWpara8xybjMUDGcLklOeZSF12xnYHLE37rel2g";

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

    if (controller) 
        [self presentModalViewController: controller animated: YES];
    else {
        tweets = [[NSMutableArray alloc] init];
        [self updateStream:nil];
    }

Solution

  • I found the answer of my question:-

    - (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username {
    
        NSLog(@"Authenticated with user %@", username);
        [_engine getUserInformationFor:username];//this line to be added to get userInfo method called
    }