I am using following code. It takes me to FB Dialog box where I authorize the app and after authorizing app it takes me back to my applicaiton. However It NEVER post anything on the wall.
Any ideas what is wrong?
- (void) login
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.facebook = [[Facebook alloc] initWithAppId:#"MY_APP_ID" andDelegate:self];
NSArray* permissions = [NSArray arrayWithObjects:#"publish_stream", nil];
[appDelegate.facebook authorize:permissions];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#".", #"name",
#".", #"caption",
nil];
/*
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#".", #"name",
#"Build great social apps and get more installs.", #"caption",
#"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", #"description",
#"https://developers.facebook.com/ios", #"link",
#"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", #"picture",
nil];
*/
// Invoke the dialog
[appDelegate.facebook dialog:#"feed" andParams:params andDelegate:self];
}
You should do it like this:
graphPath = #"me/feed";
[params setObject:#"link" forKey:#"type"];
[params setObject:pict forKey:#"picture"];
[params setObject:self.url forKey:#"link"];
[params setObject:self.message forKey:#"message"];
[params setObject:self.urlName forKey:#"name"];
[params setObject:self.caption forKey:#"caption"];
[params setObject:self.urlDescription forKey:#"description"];
[appDelegate.facebook requestWithGraphPath:graphPath andParams:params andHttpMethod:#"POST" andDelegate:self];
Related
below is my code
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"MyTestAPP", #"name",
#"http://myserver.com/", #"link",
#"My Post!", #"caption",
#"ValuedCommunity", #"description",
myMessage, #"message",
nil];
// Publish.
[facebook dialog:#"feed" andParams:params andDelegate:self];
Now with this code when I click on publish button I get this
I have tried graph api using the below code but it gave me an error msg of "facebookerrdomain error 10000".
[facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
Now What I want to do is, want to set "myMessage" text instead of Say Something about this.
Is it possible to do so??
If yes then how can I achieve it.
Please Advice
Thanks
Everything is possible. Use requestWithGraphPath:andParams:andHttpMethod:andDelegate: method and set permission as publish_stream, then you will get message.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
yourMessage,#"message",nil];
NSString *user_selected = [NSString stringWithFormat:#"me/feed"];
[facebook requestWithGraphPath:user_selected andParams:params andHttpMethod:#"POST" andDelegate:self];
Hi Every1 I was Trying to solve this from past 2 days And How I solved
add One more parameter named access_token in NSMutableDictionary's param object like this
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Ahha", #"name",
#"http://vctestserver.com/", #"link",
#"VCAHHA", #"caption",
#"ValuedCommunity", #"description",
storyTwtFB, #"message",
accessToken,#"access_token",
nil];
[facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
Where I got accessToken's Value from delegate mathod [facebook accessToken]. and storyTwtb is my application's String that I wanted to post on facebook.
I'm trying implement a Facebook dialog feed, but it doesn't show anything. I have followed :
Post to user's Facebook wall with iPhone using latest FBConnect SDK
and:
http://developers.facebook.com/docs/reference/dialogs/feed/
Here is my code:
-(void) facebookPost{
NSString *kAppId = [[NSString alloc] initWithString:#"383032031757454"];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"http://developers.facebook.com/docs/reference/dialogs/", #"link",
#"http://fbrell.com/f8.jpg", #"picture",
#"Facebook Dialogs", #"name",
#"Reference Documentation", #"caption",
#"Using Dialogs to interact with users.", #"description",
nil];
[facebook dialog:#"feed" andParams:params andDelegate:self];
}
Many thanks for your help.
Froi
i think u have to set accessToken like below
[params setObject:facebook.accessToken forKey:#"access_token"];
[facebook dialog:#"feed" andParams:params andDelegate:self];
I have searched a lot of forums and thread about posting screenshot on facebook. I have found the functon which is to be added in CCDirector which creates Screenshot. I have also seen the method which post the screenshot on facebook in an album or wall. But that is not working for me.
UIImage *tempImage = [[CCDirector sharedDirector] screenshotUIImage];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
tempImage,#"message",
nil];
[facebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
screenshotUIImage is the function that makes screenshot and it is working alright.
requestWithGraphPath does not do any thing for me. I have used different keywords in params like "tempImage, #"source"," and "tempImage, #"image"," but nothing happens.
However posting text on wall, like high score with predefined image link is working alright.
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
imageSrc, #"picture",
serverLink, #"link",
postName, #"name",
customMessage, #"caption",
nil];
// Post on Facebook.
[_facebook dialog:#"feed" andParams:params andDelegate:self];
Can any one guide me through how to do the picture posting?
In your params, you can try specifying a UIImage for the the key "picture":
UIImage *tempImage = [[CCDirector sharedDirector] screenshotUIImage];
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:myCaption forKey:#"caption"];
[params setObject:myMessage forKey:#"message"];
...
// UIImage object goes here
[params setObject:tempImage forKey:#"picture"];
[facebook requestWithGraphPath:#"me/photos" andParams:params andHttpMethod:#"POST" andDelegate:self];
Trying to implement facebook wall post on the iphone app I'm working on.
How can I bypass the "Post to Your Wall" dialog box and just submit straight?
Basically I'm just trying to post a url and I don't really want to allow people to see that "Write something" textbox.
Here is the code that I have so far (from the sample app).
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"Always Running",#"text",#"http://itsti.me/",#"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
#"a long run", #"name",
#"The Facebook Running app", #"caption",
#"it is fun", #"description",
#"http://itsti.me/", #"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[_facebook dialog:#"feed"
andParams:params
andDelegate:self];
Thank you,
Tee
Just use one of the - (FBRequest*)requestWith... instance methods of the Facebook class.
Simple wall post using the old REST API:
NSString *facebookStatusMessage = #"facebookStatusMessage";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
facebookStatusMessage, #"status",
nil];
FBRequest *request = [_facebook requestWithMethodName:#"status.set" andParams:params andHttpMethod:#"POST" andDelegate:self];
It's better to use the Facebook Graph API with - (FBRequest*)requestWithGraphPath: as the REST API will get deprecated.
Then also implement some of the FBRequestDelegate protocol:
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
}
- (void)request:(FBRequest *)request didLoad:(id)result {
// result may be a dictionary, an array, a string, or a number,
// depending on the format of the API response
}
I am trying to use facebook publish API link this as given here http://developers.facebook.com/docs/reference/api/post/
NSDictionary *privacyDict = [[[NSDictionary alloc] initWithObjectsAndKeys:#"SELF",#"value",nil] autorelease];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSString *privacyJSONStr = [jsonWriter stringWithObject:privacyDict];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test test", #"message",
privacyJSONStr, #"privacy",
#"http://www.facebook.com/", #"link",
#"This name check where it will show", #"name",
#"Caption for the link", #"caption",
#"Longer description of the link", #"description",
nil];
[facebookObj requestWithMethodName:#"facebook.Stream.publish" andParams:params andHttpMethod:#"POST" andDelegate:self];
It posted successfully, but not like that as I expected
there is no caption, name, description , link etc
it shown as
This type of result I can get by this parameter
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test test", #"message",
privacyJSONStr, #"privacy",
nil];
What is the mistake, and How we can publish all the parameter
Amit Battan
try this .. its works for me
- (IBAction )publishStream{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"Posting From",#"text",#"http://www.google.com/",#"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSLog(#"Action Link String : %#", actionLinksStr);
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
#"Feed Name", #"name",
#"Feed Caption is here", #"caption",
#"Feed Description is here", #"description",
#"http://www.google.com/", #"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSLog(#"Attachment String : %#", attachmentStr);
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[facebook dialog:#"facebook.Stream.publish"
andParams:params
andDelegate:self];
}