Facebook share passs link in app name - iphone

I want to pass a link in App Name for example if user click on text via (App Name) then it navigate some specific url
If anybody can help my code is here:
Facebook *fb = [[Facebook alloc] initWithAppId:FB_ID andDelegate:self];
NSString *strUrl = [dicItemDetails valueForKey:#"imgurl"];
if ([strUrl length] == 0) {
strUrl = [[temp objectAtIndex:0] valueForKey:#"logourl"];
}
NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
[dicItemDetails valueForKey:#"menuItemName"], #"name"
, strCaption,#"description"
, strUrl, #"picture"
, [[temp objectAtIndex:0] valueForKey:#"facebook"], #"link"
, nil];
[fb dialog:#"feed" andParams:d andDelegate:self];

you can post two link with your Message posting in facebook time line like bellow way:-
-(void)fbNewuserWallpost
{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"AppName",#"name",self.FirstLinkString,#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"yourAppID",#"app_id",
#"AppName", #"name",
captonString, #"caption",
#"yourDiscription", #"description",
self.secondLinkString, #"link",
#"ImageURL", #"picture",
actionLinksStr, #"actions",
nil];
[[AppDelegate facebook] requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
}

Related

Facebook IOS SDK Feed Post Visibility

I have this function
-(void)feed_post:(NSString *)message andDelegate:(id<FBRequestDelegate>)delegate{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, #"message",
nil];
[facebook requestWithGraphPath:#"/me/feed" andParams:params
andHttpMethod:#"POST" andDelegate:delegate];
}
to post a message to the user's wall. Everything is working but the post is only visible by me. It seems that it is posting as an own private message. How should I configure the params to change the post visibility? Thanks.
This did the trick. Also I had to delete cookies.
NSDictionary *dictPrivacy = [NSDictionary dictionaryWithObjectsAndKeys:#"EVERYONE",#"value", nil];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSString *strPrivacy = [jsonWriter stringWithObject:dictPrivacy];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, #"message",
strPrivacy,#"privacy",
nil];

iphone facebook publishToStream question

I'm using the iOS facebook DemoApp example to post to my profile. It works just fine. My question is how do I add a picture link to this post? The code I'm using is:
- (IBAction)publishStream:(id)sender
{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"title",#"text",
#"http://www.link.com/",#"href",
nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
#"This is a name!", #"name",
#"This is a caption!", #"caption",
#"http://www.link.com/images/log1.png", #"picture",
#"This is a long description that goes on an on.", #"description",
#"http://www.link.com", #"href",
nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"api_key",
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[facebook dialog:#"stream.publish"
andParams:params
andDelegate:self];
}
The picture will not come up. The link I use is correct. And the post succeeds. How do I get that picture link to show up?
Thanks for any and all help.
The sample app in the Facebook iOS SDK is a little outdated. I detailed the proper way to publish to a user's stream and the relevant documentation page in my answer to this SO question.

Uploading Game Scores to Facebook in iPhone?

i am trying to access facebook in my application to submit scores for my game.. i have registered my application on fb included its api into my xcode project and i am trying to use their sample project to publish the scores using the following code but when i use this code the message is posted on my wall but not all the details are included as used in NSMutabledictionary ..what am i possibly doing wrong??
- (IBAction)publishStream:(id)sender {
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 what on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[_facebook dialog:#"feed"
andParams:params
andDelegate:self];
}
only the SHARE ON FACEBOOK message is posted on my wall along with the name of my application and rest i am not able to figure out how to use... any help will be appreciated??
Here is a modified PublishStream function that works.
- (void)publishStream:(id)sender {
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",
[NSString stringWithFormat:#"I scored %d on mycoolgame, Think you can beat me? - http://bit.ly/cJtBkE", totalScore],#"message",
nil];
[_facebook dialog:#"feed"
andParams:params
andDelegate:self];
}
As pointed our by #hemant "stream.publish" is missing. That seems to be all that is missing from the DemoApp included with the Facebook SDK.

How to post to facebook from iPhone using publish.stream without the Facebook dialog method

I would simply like to use publish.stream to post to Facebook from an iPhone app but without using the UIWebview that pops up when you call the Facebook object's dialog method. How do I do this?
SBJSON *jsonWriter = [[SBJSON alloc] init]; NSDictionary *attchmentDic = [NSDictionary dictionaryWithObjectsAndKeys:
#"Foobar",#"name",
nil]; NSString *attachmentStr = [jsonWriter stringWithObject:attchmentDic]; NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Bla-bla",#"message",
attachmentStr, #"attachment",
nil];
[_facebook requestWithMethodName:#"stream.publish"
andParams:params
andHttpMethod:#"POST"
andDelegate:self]; [jsonWriter release];

iphone facebook wall posting with image map link

is possible to attach a link (image) of a google map on the side of my wallpost throug iphone?
my wall post is ok, but i've no idea how to do with the map.
Ps in my app i've implemented also mapkit, i don't know if i make a gquery with coordinate to obtain map link or i must work using the position that i have on mapkit
i've found my solution with google static maps :D
here's my code:
dialog.attachment = [NSString stringWithFormat:
#"{ \"name\":\"%# si trova a %#\"," "\"media\":[{\"type\":\"image\","
"\"src\":\"http://maps.google.com/maps/api/staticmap?size=100x100&zoom=14&markers=color:blue|label:here|%g,%g&mobile=true&sensor=false\","
"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],}",
_facebookName, citta.text, mylat, mylong ];
to post a image use the following code (extracted from demo app
- (IBAction) publishStream: (id)sender {
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",
[NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
#"image", #"type",
#"http://www.gogle.com/", #"href",
#"http://a1.twimg.com/profile_images/457512510/iconoTwitter_bigger.gif", #"src",nil]
, nil ]
,#"media", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"api_key",
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[_facebook dialog: #"stream.publish"
andParams: params
andDelegate:self];
}