get twitter friends using my specific app - iphone

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];
}

Related

iOS Twitter User-Timeline fetching with v1.1 API

Recently Twitter has changed API to v1.1. With this API, it is now required to first login on Twitter and only then we can fetch timeline. Is that true?
Can we fetch user timeline without user login?
Thanks
I tried FHSTwitterEngine but I found STTwitter better:
https://github.com/nst/STTwitter
look at FHSTwitterEngine you can use newly FHSTwitterEngine and if you request this method without autenticating, the users status is removed... you have to send consumer key and token along with screen_name..
In FHSTwitterEngine
//get username pass to method. In Dictionary you can get all info
NSString *username = [[FHSTwitterEngine sharedEngine]loggedInUsername];
NSDictionary *data=[[FHSTwitterEngine sharedEngine]getUserProfile:username];
// method to get all user info
-(id)getUserProfile:(NSString *)username
{
if (username.length == 0) {
return getBadRequestError();
}
NSURL *baseURL = [NSURL URLWithString:url_users_show];
OAMutableURLRequest *request = [OAMutableURLRequest requestWithURL:baseURL consumer:self.consumer token:self.accessToken];
OARequestParameter *usernameP = [OARequestParameter requestParameterWithName:#"screen_name" value:username];
NSArray *params = [NSArray arrayWithObjects:usernameP, nil];
id userShowReturn = [self sendGETRequest:request withParameters:params];
return userShowReturn;
}
You can perfectly fetch a user timeline even if the user is not logged in.
You have to use the new "App Only" mode in which only the application is authentified.
See more details in this answer.

How To get twitter friends list in 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.

MGTwitterEngine is not returning re-tweets, only “original” tweets

I’m a newbie to iPhone app development and trying to create a Twitter-based iPhone app.
I’m using MGTwitterEngine to search and retrieve the timeline of people I follow.
The method I’m using is:
[twitterEngine getFollowedTimelineSinceID:0 startingAtPage:0 count:100];
Things are working great, however there are a couple of things I struggle with:
I’m only getting tweets originally posted by my followed list, no re-tweets at all. I would really like to get all tweets (original and re-tweets) at the same call, but if I need to perform two requests (one for tweets and one for re-tweets) that will work fine for me as well.
I’m getting back less than 100 tweets, though I know for a fact that people I follow have posted more than that. Any idea how to solve it?
Several people have mentioned MGTwitterEngine is lacking re-tweeting functionality. I’m not trying to re-tweet but simply to get the complete timeline (including re-tweets by people I follow).
Many thanks!
Look at this https://dev.twitter.com/docs/api/1/get/statuses/home_timeline
Specifically look at the part that say :
Include_RTS : When set to either true, t or 1,the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets...
Now in the getFollowedTimelineSinceID method you'll need to create a new object for the params dictionary something along these lines
[params setObject:[NSString stringWithFormat:#"%#", #"true"] forKey:#"Include_RTS"];
Per #bizsytes suggestion I have done two modifications to MGTwitterEngine’s
getFollowedTimelineSinceID method:
Changed the path string from #statuses/friends_timeline.%# to #statuses/home_timeline.%#
Added the Include_RTS object
Apparently it solved both my problems (retweets & number of statuses retrieved).
Now the method now looks like the following:
- (NSString *)getAllFollowedTimelineSinceID:(unsigned long)sinceID withMaximumID:(unsigned long)maxID startingAtPage:(int)page count:(int)count
{
NSString *path = [NSString stringWithFormat:#"statuses/home_timeline.%#", API_FORMAT];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
if (sinceID > 0) {
[params setObject:[NSString stringWithFormat:#"%u", sinceID] forKey:#"since_id"];
}
if (maxID > 0) {
[params setObject:[NSString stringWithFormat:#"%u", maxID] forKey:#"max_id"];
}
if (page > 0) {
[params setObject:[NSString stringWithFormat:#"%d", page] forKey:#"page"];
}
if (count > 0) {
[params setObject:[NSString stringWithFormat:#"%d", count] forKey:#"count"];
}
[params setObject:[NSString stringWithFormat:#"%#", #"true"] forKey:#"Include_RTS"];
return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil
requestType:MGTwitterFollowedTimelineRequest
responseType:MGTwitterStatuses];
}

iPhone App: Check In using Facebook Graph API

In my iPhone App I want to implement "Check in" feature (Facebook Places).
How can I check in using Facebook Graph API?
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:#"me/checkins" withGetVars:nil];
NSLog(#"getMeButtonPressed: %#", fb_graph_response.htmlResponse);
//parse our json
SBJSON *parser = [[SBJSON alloc] init];
NSMutableArray *facebook_response =(NSMutableArray *)[fb_graph_response.htmlResponse JSONValue];//[parser objectWithString:fb_graph_response.htmlResponse error:nil];
[parser release];
NSMutableArray *feed =(NSMutableArray *) [facebook_response valueForKey:#"data"];
NSLog(#"%#",feed);
In the feed you can find the jason data of the places you have checked in..
If you get the "nil" data that means you have not checked in to any places so you have to first checkin to some places using your profile and FB.but if it is coming nil in that case only
and I am using the example from this referance :-https://github.com/reallylongaddress/iPhone-Facebook-Graph-API
so adjust it as per your requirement

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.