您可以使用Fabric Twitter 库。
配置非常简单:
[[Twitter sharedInstance] startWithConsumerKey:@"_key_" consumerSecret:@"_secret_"];
[Fabric with:@[[Twitter sharedInstance]]];
之后只需使用:
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
if (session) {
NSString *userID = [Twitter sharedInstance].sessionStore.session.userID;
TWTRAPIClient *client = [[TWTRAPIClient alloc] initWithUserID:userID];
[client loadUserWithID:userID completion:^(TWTRUser *user, NSError *error) {
NSLog(@"Profile image url = %@", user.profileImageLargeURL);
}];
} else {
NSLog(@"error: %@", error.localizedDescription);
}
}];