How to display Facebook Fan Wall in iPhone App? - iphone

I would like to display Facebook Fan Wall like the way in the image below. Can you please let me know how it can be done?
Thanks!

You can pull in the list of wall feeds from https://graph.facebook.com/cocacola/statuses?access_token=... (a preview can be seen with the graph api explorer here). Then you would just parse the returned JSON and put them into UITableView cells.

You need to post to your friends feed, Easy way would be to adapt your code to use the appropriate graph method with the persons you wish to post to facebook ID (i've assumed here you have stored this from an earlier call the graph api in person.facebookID)
[facebook requestWithGraphPath:[NSString stringWithFormat:#"%#/feed/",person.facebookID] andParams:params andHttpMethod:#"POST" andDelegate:self
http://developers.facebook.com/docs/reference/api/post
To get a list of the users friends use the graph path me/friends
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
Which will return a JSON list of the users friends names and their Facebook ids, to the appropriate delegate method from FBRequest, its probably worth wrapping this set of results into a set of person objects or storing the returned NSDictionary so that you can retrieve individual friends, its upto you how you process the list of returned friends (you probably want to use a UITableView to display the user friends or filter based on some other input from the user)
Using this method will mean you do not have to use the Facebook dialogs in the iOS sdk, which does mean there is an upper limit to how many messages the user can post in a day using your app
If you wish to use a dialog you will need to include the target_id in your params dictionary and set this to the persons Facebook ID you wish to post to

Related

facebook graph api '{user-id/feed/}'doesn't show feed properly

I want to get feed of friends whose are in the my friend list ({me/friends})
I have right permissions to do that. (user_friends and read_stream)
But the result of api doesn't show feeds of my friends properly ({user-id/feed})
To be exact, the result feeds are the part of the real feed.
What's wrong with that?
You cannot get the feed of friends specific to the friends list, but you can get the user's stream / home feed using:
/me/home
It shows all the posts by friends, pages, etc. In comparison, /me/feed shows what the user has posted.

Get facebook user checkins

I need to get a list of a facebook user checkins both in photos and in status.
I tried to use graph api to query /me/locations' like:
$this->api->api('/me/locations?limit=1000');
It returns me a list of user checkins with three different types: photo, checkin or status.
My problem is that I need to get the photos that have user checkins but I can't seem to find it.
Can anyone help?
Thanks
If you look at the User documentation, under the title feeds, it lists a method of fetching only the posts which have a location (Checkin) in it.
https://graph.facebook.com/me/feed?with=location
As for getting Photos with a location (Checkin), there doesn't seem to be any documentation that suggests that the Photos can be filtered similar to the way Posts can be filtered. At best, I guess you will have to fetch all photos and then filter out the ones that do not have the place tag. Posts use the location tag while Photos use the place tag.

Using the Facebook Graph API how can find the most liked photo in an album on one of my pages?

Using the Facebook Graph API how can find the most liked photo in an album on one of my pages?
I have access to the page insights if that can be used.
There are 200 photos in each album so I don't want to do an api request for each photo.
Subsequently you may also find the most commented on.
Here is the code you request:
http://fivespot.me/fblikes.php
$likes = $facebook->api('/'.$picId.'/likes');
However if you are looking to just find out the most liked there is an app already compiled that will do this for you:
http://apps.facebook.com/imanpic/
The Graph API doesnt support querying for an arbitrary set of photos with some criteria. BUT - you can access the Likes object for each Album, which returns a data set representing all the Liked Photos in that Album. You could then just walk that data set and count the number of times you see the same photo Like.
Thus - you just need to issue a Graph API call for Likes sub-object of an Album.
See "Likes" under "Connections" at:
http://developers.facebook.com/docs/reference/api/album/

Photo posted via FB Graph API doesn't appear on the wall (and 2 more FB questions)

I post photo on the wall using Facebook Graph API, just set parameter "picture" and send POST request to "me/photos".
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.imageToFBPost, #"picture",
FACEBOOK_ICON_URL, #"icon",
nil];
[facebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
Usually (basically always) when I add photos to my PF they appear on my wall. But not in this case. I've tested yesterday about 20 times and only 1-2 times photos appeared on my wall. Basically I want them to appears on my friend's feed. Main question: is there any way to make photo appear on my wall each time she it was posted?
Second question is how to customize icon of the post? E.g. when I of mobile upload under the wall post I see this icon: . I want to see icon of my app instead. I 've set icon of my Facebook app, but it isn't showed anywhere...
3rd question is how to get link to the Facebook page with a photo?
As result of request mentioned above I receive "id" of the picture. I want to open Safari with Facebook page of uploaded picture. Is it possible? I can find only direct link to the .jpg file, but not to the FB page. I've tried to go to http://graph.facebook.com/photo_id but it does't work...
Also it isn't very clear for me ho to catch various responses in the same file. E.g. if I do login, photo posting and requesting photo info in the same class. I created request_id class variable for that and execute switch/case in method comparing request_id with constants, but this way looks "ugly" for me. Any nice solution? :)
Thanks!
1rst question: Facebook decides what to display on your friends feed. displaying one post per photo would be overwhelming so FB chooses to group your images by album into the same post.
2nd question: in your application settings page (https://developers.facebook.com/apps) you can modify the icon displayed for each one of the posts.
3rd question: each requestWithGraphPath methods return a FBRequest instance ref. Keep it somewhere and once your delegate gets called back, compare the passed FBRequest with the ones you kept asside.

iOS Development: How can I get a Facebook wall post to show in the friend's news feed?

I'm integrating Facebook into my iPhone app and I have the code working to publish a post to the user's wall after they login, but I've noticed that the post doesn't show up in the user's news feed that's seen by the user's friends. Instead, it only shows up on the wall of the user. Here's my code...
- (void)publishStream
{
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Post a message on your wall", #"user_message_prompt",
#"Hello, World!", #"message",
nil];
[facebook dialog:#"feed"
andParams:params
andDelegate:self];
}
How can I have it show up in the news feed as well? I should mention that the only permission I have set is 'publish_stream' which, as I understand it, is the only permission I need.
Thanks so much for your wisdom!
You need to post to your friends feed, Easy way would be to adapt your code to use the appropriate graph method with the persons you wish to post to facebook ID (i've assumed here you have stored this from an earlier call the graph api in person.facebookID)
[facebook requestWithGraphPath:[NSString stringWithFormat:#"%#/feed/",person.facebookID] andParams:params andHttpMethod:#"POST" andDelegate:self
http://developers.facebook.com/docs/reference/api/post
To get a list of the users friends use the graph path me/friends
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
Which will return a JSON list of the users friends names and their Facebook ids, to the appropriate delegate method from FBRequest, its probably worth wrapping this set of results into a set of person objects or storing the returned NSDictionary so that you can retrieve individual friends, its upto you how you process the list of returned friends (you probably want to use a UITableView to display the user friends or filter based on some other input from the user)
Using this method will mean you do not have to use the Facebook dialogs in the iOS sdk, which does mean there is an upper limit to how many messages the user can post in a day using your app
If you wish to use a dialog you will need to include the "target_id" in your params dictionary and set this to the persons Facebook ID you wish to post to