ファブリックを使用してログインします。以下のコードを使用してください
- (IBAction)TwitteClickAction:(id)sender
{
[[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBased completion:^(TWTRSession *session, NSError *error)
{
if (session)
{
NSLog(@"signed in as %@", [session userName]);
NSLog(@"signed id in as %@", [session userID]);
TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
NSURLRequest *request = [client URLRequestWithMethod:@"GET"
URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
parameters:@{@"include_email": @"true", @"skip_status": @"true"}
error:nil];
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError)
{
if (data)
{
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
NSLog(@"info is ====>%@",json);
}
else {
NSLog(@"Error: %@", connectionError);
}
}];
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
}
ありがとうございました。私は、Webベースのアプローチについて言及することを忘れていました。 –