I am new to iPhone development.I am using fabric for twitter login.For this am using this code.
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession* session, NSError* error) {
if (session)
{
NSLog(@"signed in as %@", [session userName]);
}
else
{
NSLog(@"error: %@", [error localizedDescription]);
}
}];
Now,i want to get user’s First name and last name from twitter.I have done R&D on this and find some code Get user profile details (especially email address) from twitter in iOS
But i am not unable to understand this code.Because it’s give some error in my code.
error is
Error: Error Domain=TwitterAPIErrorDomain Code=99 "Request failed: forbidden (403)" UserInfo={NSErrorFailingURLKey=https://api.twitter.com/oauth2/token, NSLocalizedDescription=Request failed: forbidden (403), NSLocalizedFailureReason=Twitter API error : Unable to verify your credentials (code 99)}
2
Answers
It might be too late to answer this question, but this might be helpful. Let’s say you’ve already installed the Twitter SDK in you iOS app. You can get Twitter user’s info like this:
1. Login with twitter:
2. Use the TWTRAPIClient to retrieve user’s data: