How can I add my own picture for the feed. I have it in my application folder. I have to give my image instead of #"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png".
- (void)apiDialogFeedUser {
currentAPICall = kDialogFeedUser;
SBJSON *jsonWriter = [[SBJSON new] autorelease];
// The action links to be shown with the post in the feed
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"Get Started",#"name",#"http://m.facebook.com/apps/hackbookios/",#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
// Dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"I'm using the Hackbook for iOS app", #"name",
#"Hackbook for iOS.", #"caption",
#"Check out Hackbook for iOS to learn how you can make your iOS apps social using Facebook Platform.", #"description",
#"http://m.facebook.com/apps/hackbookios/", #"link",
#"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", #"picture",
actionLinksStr, #"actions",
nil];
HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"feed"
andParams:params
andDelegate:self];
}
I want to have my image over there. Please help.
The 'picture' parameter only accepts urls of already hosted pictures.
If you want to use a picture which is stored locally then you'll need to upload it first to a server and then use that url when posting to the feed.
Related
Hi, I am trying to implement app request to my facebook friends. I tried the following code to sent the app invite:
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary *testingDic = [NSDictionary dictionaryWithObjectsAndKeys:
#"5", #"wow",
#"1", #"testing",
nil];
NSString *testStr = [jsonWriter stringWithObject:testingDic];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Learn how to make your iOS apps invite.", #"message",
#"Check this out", #"notification_text",
testStr, #"data",
nil];
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"apprequests"
andParams:params
andDelegate:self];
I can see the above code executes with out error, but I am not getting the Request Id from the Facebook as response and more over I can't see my App request in Facebook.
Please help me out.
- (void)apiDialogFeedUser {
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:#"test",#"name",#"http://test.co.in",#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"test", #"name",
#"test", #"caption",
#"test", #"description",
#"http://test.co.in", #"link",
#"http://test.co.in/images/b_freequote.jpg", #"picture",
actionLinksStr, #"actions",
nil];
Demo1AppDelegate *delegate = (Demo1AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"feed"
andParams:params andDelegate:self];
}
I am using the code above to post to Facebook wall. But after when the dialog opens its suddenly throwing exec_bad_access. Its pointing to decodeGIFFrame. I have no idea what it is. Can anybody suggest what the problem is? Hope everybody understood my question.
Thanks in advance.
UPDATE:
I found the problem is with Facebook AppId. When I tried it with Hackbook id this problem disappeared. But I don't know what settings in my AppId is causing this problem. Any idea?
I am answering my own question. When I changed the default logo of my application through developer.facebook.com its solved my issue. Its really worked! Hope this will help somebody.
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.
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];
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];
}