ios - 在iOS上,如何获取用户也在Twitter上关注的关注者列表?

标签 ios objective-c twitter twitter-oauth

在我的应用程序中,我想向Twitter friend 发送直接消息以邀请其使用该应用程序。为了发送直接消息,我需要目标人员关注用户。但是我不想列出所有关注者,而只列出用户也关注的关注者。有没有办法在iOS中获取此列表?

谢谢

最佳答案

使用FHSTwitterEngine

#导入“FHSTwitterEngine.h”

添加 SystemConfiguration.framework

将以下代码写入您的viewDidLoad(用于oauth登录)

UIButton *logIn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
logIn.frame = CGRectMake(100, 100, 100, 100);
[logIn setTitle:@"Login" forState:UIControlStateNormal];
[logIn addTarget:self action:@selector(showLoginWindow:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:logIn];

[[FHSTwitterEngine sharedEngine]permanentlySetConsumerKey:@"Xg3ACDprWAH8loEPjMzRg" andSecret:@"9LwYDxw1iTc6D9ebHdrYCZrJP4lJhQv5uf4ueiPHvJ0"];
[[FHSTwitterEngine sharedEngine]setDelegate:self];


 - (void)showLoginWindow:(id)sender {
UIViewController *loginController = [[FHSTwitterEngine sharedEngine]loginControllerWithCompletionHandler:^(BOOL success) {
    NSLog(success?@"L0L success":@"O noes!!! Loggen faylur!!!");
    [[FHSTwitterEngine sharedEngine]loadAccessToken];
    NSString *username = [FHSTwitterEngine sharedEngine].authenticatedUsername;
    NSLog(@"user name is :%@",username);
    if (username.length > 0) {
        [self listResults];
    }
}];
     [self presentViewController:loginController animated:YES completion:nil];
}
 - (void)listResults {

NSString *username = [FHSTwitterEngine sharedEngine].authenticatedUsername;
NSMutableDictionary *   dict1 = [[FHSTwitterEngine sharedEngine]listFriendsForUser:username isID:NO withCursor:@"-1"];

//  NSLog(@"====> %@",[dict1 objectForKey:@"users"] );        // Here You get all the data
NSMutableArray *array=[dict1 objectForKey:@"users"];
for(int i=0;i<[array count];i++)
{
    NSLog(@"names:%@",[[array objectAtIndex:i]objectForKey:@"name"]);
}
}

关于ios - 在iOS上,如何获取用户也在Twitter上关注的关注者列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24281496/

相关文章:

iOS:带有四个圆形按钮的动画

python - 如何抓取大量推文

regex - Twitter 名称验证

ios - 与 SDWebImage 相关的架构 arm64 的重复符号

ios - NSFileManager defaultManager 如何知道一个文件是否打开?

ios - 无法提交 iOS 应用程序以供审核 - "There are one or more errors on the page."

ios - iPhone 5 与 iPhone 4 的图像命名

c++ - 包含 C++ 文件时构建失败

objective-c - 获取与释放实例相关的崩溃

php - 列出来自 protected 帐户的推文?