我正在开发一个有Twitter登录的应用程序。我为此集成了MGTwitterEngine
,一切正常。
我的问题是,当用户登录时,我需要一些细节 - MGTwitterEngine
为该登录用户返回的任何信息。
当我查看库文档时,我发现下面的委托方法可能会提供一些用户信息,但是当我登录时,这个方法永远不会被调用。
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {
NSLog(@"User Info Received: %@", userInfo);
}
有人可以建议我如何从MGTwitterEngine
获取用户的信息,或者我应该如何使用这种方法?
_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];
}
答案 0 :(得分:1)
我找到了问题的答案: -
- (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
}