How To get twitter friends list in iphone - iphone

I am using Twitter API for my iPhone app,and i want to get my twitter friends list,i followed the older posts but not getting the answer,any one please help me out...
(NSString *)getFollowersIncludingCurrentStatus:(BOOL)flag{
NSString *str=[[NSString alloc]init];
str =[_engine getFollowersIncludingCurrentStatus:YES];
NSLog(#" string is %# ",str);
}
-(void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {
NSArray *mFollowerArray = nil;
mFollowerArray = [userInfo retain];
NSLog(#"mfollwers arra is %#",mFollowerArray);
}

First thing is that twitter is having followers and not friends. check this link. You might get a direction for your search. Thanks.

Related

get twitter friends using my specific app

I am integrating twitter api on iphone device with specific application. I want to get list of followers using the same app.
Is it possible to get list of followers who are using the same app?
Thanks,
Jim.
Use this api call in your twitter api to get your followers in twitter
- (NSString *)getFollowersIncludingCurrentStatus:(BOOL)flag
{
NSString *path = [NSString stringWithFormat:#"statuses/followers.%#", API_FORMAT];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
if (!flag) {
[params setObject:#"true" forKey:#"lite"]; // slightly bizarre, but correct.
}
return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil
requestType:MGTwitterFollowerUpdatesRequest
responseType:MGTwitterUsers];
}

Facebook friend list

I am working on application where I want to access user friends list by login into facebook application. I am using xcode 4.2 ios 5 framework. I have gone through many tutorial but didn't find proper solution. please help me out.
- (void)getFriendsResponse {
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:#"me/friends" withGetVars:nil];// me/feed
//parse our json
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary * facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];
//init array
NSMutableArray * feed = (NSMutableArray *) [facebook_response objectForKey:#"data"];
NSMutableArray *recentFriends = [[NSMutableArray alloc] init];
//adding values to array
for (NSDictionary *d in feed) {
NSLog(#"see Dicitonary :%#",d );
facebook = [[Facebook alloc]initWithFacebookDictionary:d ];
[recentFriends addObject:facebook];
NSLog(#"Postsss :->>>%#",[facebook sender]);
[facebook release];
}
friends = recentFriends;
[self.tableView reloadData];
}
use facebook graph api. To get a list of their friend lists, you need read_friendlists extended permission. Graph Api reference and permissions

How can I get the email id list using Twitter Integration in the iPhone SDK?

How can I get the Twitter email id list in the iPhone sdk?
I'm using MGTwitterEngine and when I try the following method:
NSString *str2 = [_engine getUserInformationForEmail:#"yw8181#gmail.com"];
NSLog(#"User Email Id:--->%#",str2);;
so its return 0E156D0F-3E56-4935-9BE9-2A34786545ED so how can i display in tableView
I'm not getting email id list, please help me solve this issue.
What happens when you log it?
I'm guessing that it doesn't return an NSString, but another datatype like an NSArray?
Try this:
NSArray *myArray = [_engine getUserInformationForEmail:#"yw8181#gmail.com"];
for (NSString *item in myArray) {
NSLog(#"%#",item);
}

facebook connect not working

This all is driving me nuts.
I just integrated facebook in my iphone app.
After typing in my username and password in the login dialog this method is called.
- (void)request:(FBRequest*)request didLoad:(id)result {
if ([request.method isEqualToString:#"facebook.fql.query"]) {
NSLog(#"result %#",result);
NSArray* users = result;
NSLog(#"users %#",users);
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:#"name"];
self.facebookName = name;
if (_posting) {
[self postToWall];
_posting = NO;
}
}
}
But after this the app crashes most of the times and when I tried to log the "result" array it appears to be empty. Why is it so?
What should I do? Please suggest.
use this code
NSArray *users=[[NSArray alloc]initWithObjects:result, nil];
NSLog(#"users %#",users);
NSDictionary* user = [[NSDictionary alloc]initWithObjectsAndKeys:users,#"users", nil];
NSLog(#"%#",user);
I got the reason for this.
This was due to the session getting lost frequently in between.
So I had to call [session resume] in the facebook login action event
and in this manner if at all the session is lost by any chance then the previous session is resumed and the "result" does not appears to be nil in (void)request:(FBRequest*)request didLoad:(id)result method.
Hope this helps out those who are stuck in the same issue.

Calling Facebook API method from iPhone SDK

I got Facebook Connect working and all and it's loading up the user's friends list with perfection. So now I have the logged in user's UID and the friend's UID. How would I go about calling their users.getInfo method from the SDK? The example below is what they give me to set a status, but I don't know how I can transform it to work with what I need. Especially the NSDictionary part. Please help!
Example Code -
NSString *statusString = exampleTextField.text;
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
statusString, #"status",
#"true", #"status_includes_verb",
nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.Users.setStatus" params:params];
Thanks for any help!
According to the documentation at http://github.com/facebook/facebook-iphone-sdk you have to use the old API calls and the Facebook Query Language (fql) to pull information via the SDK. So you'd have to identify what information you want (or pull in a bunch and separate).
Here's the example they give to pull a user's name.
- (void)getUserName {
NSString* fql = #"select name from user where uid == 1234";
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:#"query"];
[[FBRequest requestWithDelegate:self] call:#"facebook.fql.query" params:params];
}
- (void)request:(FBRequest*)request didLoad:(id)result {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:#"name"];
NSLog(#"Query returned %#", name);
}
getUserName shows you the data pull which you could adapt to create new routines--but the request:didLoad: function would need some internal switching.