I was able to update status using FBStreamDialog object. The case is i want to update it with a programmatically added message.. Any way of doing that???
Thanks in Advance
You need "publish_stream" for posting stream or any message you want to post without user interaction.
NSString *message = #"test message here";
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:message forKey:#"message"];
[_facebook requestWithMethodName:#"facebook.Stream.publish" andParams:params
andHttpMethod:#"POST" andDelegate:self];
Then you can handle the response in "Delegate" methods of facebook i.e.
- (void)request:(FBRequest *)request didLoad:(id)result
Hope that helps, Please mark as answer if it does.
Thanks
Related
I want to implement facebook like button in my native iphone app. So that user can like my facebook page . I am already sharing facebook status updates, but am unable to implement like button.
I was unable to find any helpful resource on web.Please help.
Aaaand here's one I prepared earlier (using FBConnect, the FB api):
If you have the id of the post as postId
NSString *graphPath = [[NSString alloc]
initWithFormat:#"%#/likes",
postId];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[[delegate facebook] requestWithGraphPath:graphPath andParams:params andHttpMethod:#"POST" andDelegate:self];
of course you'd need to change how you got the Facebook singleton (I used [delegate Facebook]).
http://developers.facebook.com/docs/reference/api/post/ doesn't seem to give a clue about it. Would "Install(ed)" be an action? If the feed is something like " installed on iPhone", how to make the to be a link such that the user can tap on it so to lead the user to App Store?
I know the API to use, something like the following. But I just don't know what are the params that should be there for the above feed.
NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithCapacity:1]
[params setObject:username forKey:#"name"];
[params setObject:#"Description" forKey:#"description"];
[facebook requestWithGraphPath:#"me/feed"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
You can get all info of setting the facebook ios sdk with a screenshot of a post..
http://developers.facebook.com/docs/mobile/ios/build
I want to share some posts in facebook via graph api.
But there's no api like this. only "feed" exists.
I tried to use "me/feed" graph api action to share my friend's post(and post in page). but it's not same as i shared in facebook website. i want to know how.
source is..
NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];
NSString *linkURL = #"http://media.daum.net/society/others/view.html?cateid=1067&newsid=20120106140112792&p=munhwa&RIGHT_COMM=R4";
[fbArguments setObject:linkURL forKey:#"link"];
[facebook requestWithGraphPath:#"me/feed"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
[fbArguments release];
And I noticed there's no action for sharing friend's post(or photo), page's post via facebook iphone app. (so weird. don't you need this action?)
what can i do? can you help me?
Thanks.
i'v succeeded sharing photo. that is 'Link'.
source is
NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];
NSString *linkURL = #"https://www.facebook.com/photo.php?fbid=324225380935287&set=a.265279620163197.68309.194442110580282&type=1";
[fbArguments setObject:linkURL forKey:#"link"];
[fbArguments setObject:#"good!" forKey:#"message"];
[facebook requestWithGraphPath:#"me/feed"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
[fbArguments release];
i added message. and this is perfectly same as i shared via facebook web.
but there is one problem. this never makes back reference(trackback?).
if I share a photo via facebook web, I can see "5 shares" upper comment list, and my username is is there.
But this way, There is no my username. No trackback.
what can i do?
thanks.
I've set up Facebook connect with my app using the demo project provided by Facebook. Everything works great, except for the last little step...
First of all, I login and get permissions.
Next, I upload a picture. This works great, I can see the picture in my Facebook album like I should be able to.
When this picture is uploaded, I get it's URL (returned by the FBRequest delegate). Copy pasting this URL into a web browser takes me directly to the image, so I know that this URL is correct.
Here's where the problem is:
I now want to present this picture alongside a wall post. The wall post is fine, but the picture just doesn't seem to attach and the status is left as a plain text message.
Here's the code I'm using for the last part:
- (void)request:(FBRequest *)request didLoad:(id)result {
NSString* picUrl = [result objectForKey:#"src_big"]; //this definitely returns the right URL
if (picUrl)
{
NSString *message = #"Test status";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, #"message", picUrl, #"picture", #"Look at my photo", #"name", nil];
[facebook requestWithMethodName:#"facebook.Stream.publish" andParams:params
andHttpMethod:#"POST" andDelegate:self];
}
}
Any ideas what I'm missing or doing wrong?
Fixed with the following code (after a lot of failed attempts). Facebook doesn't like the way I was trying it, you've got to do it all in just one step:
NSData *imageData = UIImagePNGRepresentation(image);
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test message", #"message", imageData, #"source", nil];
[facebook requestWithGraphPath:#"/me/photos" andParams:params andHttpMethod:#"POST" andDelegate:self];
Can't comment yet but to get this working I had to change #"/me/photos" to #"me/photos" in Jordan's answer above. Very helpful though, not sure why it was down voted.
I know many question has been post and answer for this question. I still stuck by a little thing.
I did success upload an UIImage on Facebook via my iPhone app but I realize that photos goes to a pending album. And user had to accept it to get it post on their wall.
Here is my code
- (void)start
{
NSArray *permissions = [NSArray arrayWithObjects:
#"read_stream", #"offline_access", nil];
[_fbEngine authorize:kFbAppId
permissions:permissions
delegate:self];
}
#pragma mark -
#pragma mark FBSession delegate
- (void)fbDidLogin
{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.image, #"picture",
nil];
[_fbEngine requestWithMethodName:#"photos.upload"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
Is there a way to post a photo directly on the wall without passing by the pending album.
Regards,
KL94
Add #"publish_stream" to your list of requested permissions.
That'll let you push straight to their wall without an intermediate step. #"offline_access" would allow you to do that via the graph api instead of with a FBDialog, too, so you could make the post happen entirely in the background.