att*_*ila 1 twitter objective-c ios twitter-oauth
在我的应用程序中,我想向Twitter朋友发送一条直接消息,邀请他们使用该应用程序.为了发送直接消息,我需要目标人员跟随用户.我怎么不想列出所有关注者,只列出用户也关注的关注者.有没有办法在iOS中获取此列表?
谢谢
#import"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"]);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1162 次 |
| 最近记录: |