Twitter关注API

问题描述:

我需要让这个人在Twitter上使用API​​来关注另一个人。Twitter关注API

我知道叽叽喳喳迁移到1.1版

我使用这些API来得到两个人之间的关系,

https://api.twitter.com/1.1/friendships/exists.json?screen_name_a=Person1&screen_name_b=Person2

https://api.twitter.com/1.1/friendships/lookup.json?screen_name=Person1,Person2

,但我得到的最终结果是,

{ 
errors =  (
      { 
     code = 215; 
     message = "Bad Authentication data"; 
    } 
); 
} 

是否有任何其他确切的API可以找到我的解决方案。

任何人都可以帮助我找到一个人跟随另一个人。

+0

的错误是“坏的认证数据” - 你有没有正确注册你的应用程序,并得到您的认证令牌? –

+0

特伦斯伊登谢谢你的回复。我用这个方法http://*.com/questions/8085055/how-to-follow-people-with-the-new-twitter-api-in-ios-5,它工作正常。 –

试试这个代码,你可以得到你所期待的东西,

-(void) followUsOnTwitter { 

ACAccountStore *accountStore = [[ACAccountStore alloc] init]; 

ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; 

[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) { 
    if(granted) { 
     // Get the list of Twitter accounts. 
     NSArray *accountsArray = [accountStore accountsWithAccountType:accountType]; 

     // For the sake of brevity, we'll assume there is only one Twitter account present. 
     // You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present. 
     if ([accountsArray count] > 0) { 
      // Grab the initial Twitter account to tweet from. 
      ACAccount *twitterAccount = [accountsArray objectAtIndex:0]; 

      NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init]; 
      [tempDict setValue:@"abcd" forKey:@"screen_name"]; // Change the Value String 
      [tempDict setValue:@"true" forKey:@"follow"]; 

      TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.twitter.com/1.1/friendships/create.json"] 
                 parameters:tempDict 
                 requestMethod:TWRequestMethodPOST]; 

      [postRequest setAccount:twitterAccount]; 

      [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { 
       NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]]; 
       NSLog(@"%@", output); 
       if (urlResponse.statusCode == 200) 
       { 

        // follow by usr 

       } 
      }]; 
     } 
    } 
}]; 
} 

你可以检查这个答案: 在v1.1 API中,他们用友谊/查找API代替它,你可以指定一个逗号分隔的列表,最多可以有100个用户,它会告诉你关于认证用户和每个用户之间的连接指定

+0

Anil Dhiman,我也检查过它,只是看到我的问题在第二个链接,.. –