Question

I'm looking to possibly build an iOS app where I would need to get a list of friends of the logged in user who are also using the app and then loop over that list to get an even bigger list of their friends who are also using the app. Hopefully the little scenario below will better illustrate what I mean if it's not clear

Lets say "Sam" uses my app and he has 400 friends of which 30 are using my app. I would like to loop the 30 friends who are using the app to get their friends list so lets say the first person of the 30 is "Jake" and he has 10 friends who are also using the app they should be added to an array and then the next person in the 30 people loop is "Jen" and she has 15 people using the app they would be added to Jake's 10 friends and so on.

I know it's possible according to this link Get a list of friends of a friend on Facebook to get the friends list of a friend but my main concern is speed. Do you think getting a list of friends of friends would take too long for a user of the iOS app?

Était-ce utile?

La solution

The list grows linearly, so I don't think there would be much of a speed issue. You can always set a limit to the total number of calls. For example, if I have 200 friends using your app and you limit the number of calls to 100, only the first 100 friends' friends will be shown. That can be quite an extensive list.

You could also inform your user that the operation he/she is trying to perform might take a while and give them the right to cancel at any time. When they cancel you could display the data you already received.

As a last note instead of using an array to store the friends of friends list, It would be better to use a set because chances are many of those people are already friends with each other. So if "Jake" and "Jen" are friends, they would not appear twice on the list.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top