How do I select friend ids using the facebook api? - ios

Whenever I call FB.ApiRequest() to send invites it brings up a native facebook menu to quickly select friends.
Is there any similar call which would allow me to select friend's user ids in a similar manner/interface like above.
I want to do this so that a user can monitor only selected friend's scores in an app.
This is my first time playing around with the facebook api, and I couldn't find much info about this in fb's documentation.

You just need to call /me/friends after authorizing with the user_friends permission and develop your own selector. Keep in mind that you can only get friends who authorized the App too.

Related

Is it possible to retrieve the _whole_ friendlist of a user using the iOS Facebook SDK?

I am reading through the docs and other questions on Stackoverflow. Am I getting this right that it is actually impossible to retrieve the whole friendlist of the user? The permissions user_friends only refers to friends that have previously logged into the same app with Facebook.
I am wondering if I just oversee the solution or if it is indeed impossible to get access to a user's friends because there is no API that would allow to do so?
Since graph API v2.0, this is no longer possible:
See
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends#readperms
This will only return any friends who have used (via Facebook Login) the app making the request.
https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.
As Tobi says, in V2.0 this is no longer possible.
But, if you want to get only name and profile picture, then its possible!
Check taggable_friends
Note that The id that returns this API call isn't unique, it may change for every request for same user, so you can't use that field to identify user, you can use it ONLY for tagging.

Facebook SDK, fetching friends

I am currently building an app, and I need to fetch all the friends of a user, in order to display them to that specific user (public picture + name).
I have tried to implement the taggable_friend into my app in order to do so, but Facebook is not giving me the permission to use it as they say it should only be used to tag friends in stories.
Also, my question is, how apps like "Tinder" and "Hot or Not" do to get access to my entire friend list (even the one not using the app)?
And in the case of "Hot or Not", they even display my friends not using the app so that if I like them, I can invite them to join.
In the v2.0 release on the Facebook Graph API, the ability to access a person's friends was changed in two ways. The first was via a new permission:
Friend list is no longer part of the default permission set and has
its own permission: Asking for access to a person's friend list is now
a separate permission that your app must request. The new permission
is called user_friends.
The second affected which people are returned when requesting the list of friends:
Friend list now only returns friends who also use your app: The list
of friends returned via the /me/friends endpoint is now limited to the
list of friends that have authorized your app.
You can find more information here:
https://developers.facebook.com/docs/apps/changelog#v2_0
I tested a lot Facebook API this year, and Facebook won't let you see your friends, for security matters, they only let you see the ones registered in the same app. If you are seeing the ones that are not, probably Tinder or whatever app is not using the latest version, v1.0 i guess, that will expire on April 30th, 2015.

Facebook IOS Sdk find all friends ids

I'm looking for doing a tableview which allow you to select one facebook friends and be able to send him a message to his wall later. The thing is that i tried /me/friends but it returns only the friends which use the same app...and it's not really usefull then.
I also tried /me/taggable_friends but it returns me an id for tag the friend and doesn't work for sending a message...
The last one i didn't try is /me/invitable_friends since it's not a game...but i guess it's also using an id only for invitation...
So is there a way to get the list of all the friends of facebook and get there ids ?
thanks !
That isn't supported anymore. There doesn't appear to be a simple way to grab all of a user's friends. You could use /user/invitablefriends, but that comes with a whole host of caveats. From the docs:
A list of friends that can be invited to install a Facebook game.
The Invitable Friends API is only available to apps classified as Games, which also have a Canvas presence. This API is not available in v1.0. It may be called by mobile games as long as they also have a Canvas presence.
The Invitable Friends API is only available to apps classified as Games, which also have a Canvas presence. This API is not available in v1.0. It may be called by mobile games as long as they also have a Canvas presence.
Since Graph API v2.0, /me/friends returns a person's friends who also use the app. You may use the Requests Dialog to invite people to play a game. However, if you want to build a custom multi-friend selector within your game, you need to use call /me/invitable_friends which returns a ranked list of a person's friends who do not play the game, along with a token which can be passed to the Request Dialog in order to invite them. Read our guide on using the Invitable Friends API.
Additionally, posting to another user's wall cannot be done through the Facebook SDK anymore. You can post to your own wall and you can tag other users, but you can't post directly to their wall anymore.

Use paging in facebook api

I have been trying to fetch the list of friends. The sample code with IOS facebook SDK gives all the friends i currently have but when i try to fetch list manually using graph api . I get only a few. Then i read under permissions "This will only return any friends who have used (via Facebook Login) the app making the request." My questions is
1. how come sample IOS facebook code can fetch all the friends and when i make graph api call i get only few. The call i am using "me/friends" ?.
Will it be possible to get friends ids or emails?
As of 4/30/2014, you can only access the friends who also use the app, and you have to explicitly ask for the user_friends permission to even get that.

Facebook SDK iOS invite user without FBWebDialogs

I want to get list of my friends from Facebook who are not users of my app, and be able to invite them.
Using FBWebDialogs I can pick users, but I'm wondering how foursquare did it?
Screenshot:
There is option of frictionless requests.
On Facebook developer site they mentioned in section of Invites and Requests
We touched on a scenario where users exchange requests back and forth. If this scenario is typical in your game, it can be a bad user experience to force them through the request dialog every time they want to send a request. The solution for this is frictionless requests.
Frictionless requests let users send requests to friends from an app without having to click on a pop-up confirmation dialog. When sending a request to a friend, a user can authorize the app to send subsequent requests to the same friend without another dialog. This streamlines the process of sharing with friends.
For more reference see Facebook Invites and Requests
You are asking two questions here:
How to invite Facebook friends without web dialogs?
Unfortunately, the web dialogs you are referring to are the best way to send invites to friends. There was a time when we had to resort to ugly hacks just to get this functionality in applications. Facebook added this functionality to iOS SDK after developers created bug reports and were literally behind them.
Get a list of friends who are not using the app and invite them
Foursquare IMO is not using the requests API. What they do is, whenever somebody links their Facebook account to their Foursquare account they make a note of the users friends who are using/not using the app. This is possible if the user grants the app permissions.
Then in the invite screen, they simply build a UITableView with list of friends who they think are not using the app. When you tap Invite they will just send an email invitation and not the Facebook request you are referring to.
I think FourSquare syncing the user's friend list(friend ids) to its own server.. Then after they are checking it to create the custom interface like the screen shot you shared.
Maybe I didn't get the question right, but from what I know after you tap the invite button on Foursquare the Facebook invite dialog (apprequest) will pop up.
In general this dialog will let you select friends if you didn't specify any friends ids before presenting it, or show you the selected friends like in Foursquare example.
There is an API to get your FB friends, so it's possible for your server to check witch of then already has the app...
I've been researching this for a while and the main solution I have found is frictionless requests, as Rahul Patel noted. You can do a direct request to the graph API and see who has your app installed.
From there you could fairly easily implement any sort of filtering. For example, using the Friend Picker UI Control and implementing the method friendPickerViewController:shouldIncludeUser: and checking against a list of facebook ids who are not on the app that you cache somewhere else in your application and actively update it (for example in a simple core data model that is updated when appDidFinishLaunching), returning no if the user is not displayed. This would only allow users to select individuals who are not on the app, and then you could send a request to them under the hood with frictionless requests.
I do think that it is not a great idea to spam people, however, without at least allowing them to check the names of their friends, or see who they are.

Resources