Display comments alone from Facebook post id iOS - ios

my code to fetch the message from Facebook.. this code fetches the comments along with id likes and comment likes.. i need to fetch the name and comments alone..
thank you in advance pls help me in that..
NSString *url1 = [NSString stringWithFormat:#"10203405506644140/comments"];
[FBRequestConnection startWithGraphPath:url1
parameters:NULL
HTTPMethod:#"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
FBGraphObject *postDetails = result;
NSLog(#"--comments--->%#",postDetails);

You can get the comment message from result by objectForKey:#"message" in a loop.
To refer the field in receiver object please go through iOS section of this link. https://developers.facebook.com/docs/graph-api/reference/object/comments/

Related

Get Facebook user's page likes iOS

I am making an iOS application where I want to get the list of all the pages that has been liked by the Facebook user. I have already used the permission 'user_likes' using Facebook Graph API. Now I want to display it.
Refer this: https://developers.facebook.com/docs/graph-api/reference/v2.2/object/likes
Kindly help.
I got my answer and this is how I made it happen:
//Page likes
/* make the API call */
[FBRequestConnection startWithGraphPath:#"me/likes?limit=10" parameters:nil
HTTPMethod:#"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(#"Likes are:\n\n%#",result);
}];
NSString *fbCountry=[

facebook Like and comment not working in ios

I am working on Facebook like and comment in ios,i am getting the response i.e id of a like object.But it is not showing in Facebook.I am using this code to like a object.
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
#"http://samples.ogp.me/226075010839791", #"object",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:#"/me/og.likes"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
}];
I am getting one more problem i.e if i clicked on another object of a same user it is giving an error.
message = "(#3501) User is already associated to the object type, website, on a unique action type Like. Original Action ID: 654561277932515";
Please help me.

How to Like in Facebook using FacebookSDK.framework Facebook

I have used FacebookSDK.framework for Facebook integration in my application. I have to like one facebook page from application. I have used following code for liking page.
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:#"https://www.facebook.com/demoappname"
, #"object",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:#"me/og.likes"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
)
{
NSDictionary *currentResult= [(NSArray *)[result data] objectAtIndex:0];
if(!error)
{
NSLog(#"there is no error");
}
else
{
NSLog(#"There is something wrong at here.");
}
}];
But I am not clear what I have to pass in "object" parameter. Can anybody help to what I am doing wrong at here.
Thanks,
If you read this documentation, it says-
The og.likes action can refer to any open graph object or URL, except for Facebook Pages or Photos.
So, liking a page with Graph API isn't possible.
The only thing you can do- add a Like Button to the page in your app.

How to post comment reply on a specific post in iOS programmatically?

I am new to iOS programming and I just want to know that how can we reply on a specific post?
I have read a lot of links but I can't get the point.
http://developers.facebook.com/docs/graph-api/reference/object/comments
I have use this method but it is not working properly this code update/edit your post or comment:
-(void) abc
{
[FBRequestConnection startWithGraphPath:#"/YOUR_POST_ID/comments"
parameters:nil
HTTPMethod:#"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(#"Results == %#",result);
NSLog(#"error == %#",error);
}];
}
and plus I am calling this method into my textfield
[myReplyingUITextField addTarget:self action:#selector(abc) forControlEvents:(UIControlEventEditingDidEndOnExit)];
You need to add the message parameter to your API call. Pass the comment into this parameter and you'll be able to comment on the post. See the API documentation.

Sharing to Facebook Wall

I am using facebook sdk and need to share details to facebook timeline. I am using the following api call.
[FBRequestConnection startWithGraphPath:#"/feed"
parameters:dictionary
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (!error) {
[VBUtility showAlertWithTitle:#"Facebook" message:#"Deal details posted successfully"];
}
}];
The story is published on facebook, not at user's timeline but user's newsfeed (The document tells this method does - posts and links published by this person or others on their profile.). I have also tried with /home method call. While I tried with the built in facebook share,
SLComposeViewController *fbPost = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
it is perfectly published to user's timeline as well as in news feed. I have configured the app in the developer.facebook.com. Do I need to mention any permissions here. Does any one can help me finding the mistake?
Permission Request,
NSArray *permissions = [[NSArray alloc]initWithObjects:#"publish_actions",#"user_birthday",#"publish_stream",#"user_about_me",#"email",#"basic_info",nil];
The parameters passed are,
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
app_id, #"app_id",
name,#"name",
caption, #"caption",
description,#"description",
link, #"link",
picture, #"picture",
#"1",#"fb:explicitly_shared",
nil];
Try this,
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:dictionary
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (!error) {
[VBUtility showAlertWithTitle:#"Facebook" message:#"Deal details posted successfully"];
}
}];
I changed little bit from your code. Change your path as #"me/feed". I hope, this may help you.

Resources