Post to user's Facebook wall with iPhone using latest FBConnect SDK
Asked Answered
D

2

2

I'm having a tough time finding any good documentation for the FBConnect iPhone SDK. I have the SDK set up to get the permissions from the user but making a simple post is escaping me. All I can find is documentation for the PHP web SDK.

Can anybody point me to some documentation for the iPhone SDK or let me know how I can post to a users wall using the latest graph FBConnect SDK?

Thanks!

Discarnate answered 20/12, 2010 at 2:54 Comment(0)
N
11

Have you looked at DemoApp under the sample directory in facebook-ios-sdk? There's a publishStream method that might help.

Or, you can use

- (void)requestWithGraphPath:(NSString *)graphPath
                   andParams:(NSMutableDictionary *)params
               andHttpMethod:(NSString *)httpMethod
                 andDelegate:(id <FBRequestDelegate>)delegate;

like this:

[_facebook requestWithGraphPath:@"[user_id]/feed" 
                      andParams:[NSMutableDictionary dictionaryWithObject:@"test wall post" forKey:@"message"]
                  andHttpMethod:@"POST"
                    andDelegate:self];

to post a comment to [user_id]'s wall.

Neville answered 20/12, 2010 at 6:57 Comment(5)
Hi and thanks for the reply. I'm getting facebookErrDomain error 10000 when I try to post this feed. Have you seen this before? I'm also curious if this will require a dialog to be presented to the user. Thanks again!Discarnate
I was having a login issue which was in turn causing my domain error when trying to post. Your answer worked correctly. Thanks!Discarnate
Awesome! And I see you figured out the other problem too. Way to go :)Neville
Hi all.. i have one doubt on last Mr. donkim's post. You use '_facebook' what is this?? I my application i have 'FbGraph and SBJSON' folder, so i could not access your code. I want to feet post by using FbGraph, any solution for my problem??? Thanks in advance!!!Hiroshige
@Hiroshige : You can follow Facebook's official tutorial. I guess you are using other tutorials on the Internet, right?Lemuel
G
1

U ckeck this , its in detail:

NSMutableDictionary* params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    appId, @"api_key",
                                    @"Please join me...", @"message",
                                      @"https://www.mybantu.com", @"link",
                                    @"https:/www.mybantu.com/myphoto.png", @"picture",
                                    @"my profile", @"name",
                                    @"hi to all", @"description",
                                      //    @"100001309042820", @"target_id",
                                    nil];
    [facebook requestWithGraphPath:@"[friend_ID]/feed" andParams:params1 andHttpMethod:@"POST" andDelegate:self];

WE cannot use facebook profile or photo here, Get from other sites or ur own site profile.

Guienne answered 31/12, 2010 at 7:11 Comment(3)
Does this code works? I am using something similar to post on friend's wall but getting this error: "Facebook request error: The operation couldn’t be completed. (facebookErrDomain error 10000.)". My permissions are all good and when I remove the "picture" all is working well.Flagon
Sorry but it's not work for me too. It's show Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed.Leontineleontyne
Facebook has restricted posting on friends wall using 'Graph API'. So, This API will not work for posting on friends wall.Guienne

© 2022 - 2024 — McMap. All rights reserved.