iphone posting link to facebook wall - image - ios

I am posting a link to my fb account via fbgraph API. The thing is that when I post the link to fb, an icon is appearing on left side of that link i.e, for example if I post www.google.com ,then the google image is appearing in left side of the link.
how to change that default icon to my desired icon ? (or) what is the default image location it is taking from the site.
Any idea ?
Thanks

You can set in facebook for your app.
https://developers.facebook.com/apps
It is your app icon.
For example mine is a giant wale ;-)
To add a picture to your post just add the parameter #"picture" and fillin the url to the picture you want to see.
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"myFacebookAppId", #"app_id",
#"http://www.homepage.com", #"link",
#"http//www.homepage.com/sillypicture.png", #"picture",
#"name of the post", #"name",
#"caption of my post", #"caption",
#"content of my post", #"description",
#"my message", #"message",
nil];
[[[myAppDelegate sharedDelegate] facebook] dialog:#"feed" andParams:params andDelegate:self];

Related

How to predefine message in FBDialog?

I'm integrating Facebook into my app, and I want FBDialog to be predefined with my text. So i've tried this parameters:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Some message text", #"message",
nil];
[facebook dialog:#"feed" andParams:params andDelegate:self];
But comment field is still empty, is it possible to prefill it?
Thanks!
It is not possible to pre-fill the message and is against Facebook policy so your message input is ignored.

Facebook post from IOS not working

I am trying to post something from my IOS app to facebook feed. Below is the test I included in my code.
Facebook *facebook = [[Facebook alloc] initWithAppId:FB_APPID_REMOTE andDelegate:self];
// Create the parameters dictionary that will keep the data that will be posted.
NSMutableDictionary *fbParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"My test app", #"name",
#"http://www.google.com", #"link",
#"FBTestApp app for iPhone!", #"caption",
#"This is a description of my app", #"description",
#"Hello!\n\nThis is a test message\nfrom my test iPhone app!", #"message",
nil];
[facebook requestWithGraphPath:#"me/feed" andParams:fbParams andHttpMethod:#"POST" andDelegate:self];
However, I do not see the post updated to my facebook feed. Am i missing out anything here?
The method requestWithGraphPath returns an object of FBRequest. So you can check request.state to determine the status of the request, and check request.error to know what's exactly the problem.
Using AppDelegate will result in returning to the same page View you called from the ViewController. But as you are not getting any obvious error log or crashes, I think it is some issue with the Facebook graph protocol.
Replace "me/feed" with just "feed" as that works fine for me.

Can I avoid Captcha dialog when posting picture using Feed Dialog in iOS SDK?

I am using the dialogs in Facebook iOS SDK to allow users's of our app to share a link on their news feed (SDK downloaded today to ensure I have latest version). This was working last week and began behaving differently last Friday after an outage of the API service and a capture dialog is now appearing before the user can post. But the captcha image doesn't load and it says Unknown Error in the top right corner of the captcha dialog which is ugly and seems incorrect.
Has the Facebook API changed recently to now require captcha when posting picture or link? If I remove either picture or link from the params then the post dialog loads fine. I've tried a variety of different urls for my picture or link value and nothing seems to work except removing that param completely which I don't want to do. Can I post a picture or link without the captcha step?
This is my code.
- (void)publishStream:(NSString *)postName caption:(NSString *)caption
{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary
dictionaryWithObjectsAndKeys:
#"Company Website",
#"name",
#"http://mycompanysiteurl.com",
#"link",
nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"http://mypictureurl.png", #"picture",
postName, #"name",
caption, #"caption",
actionLinksStr, #"actions",
nil];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
}
I've tried various combinations of permissions when authorizing too with no luck (publish_stream, read_stream, publish_actions, photo_upload).
Not sure if I'm missing something obvious by I've been trying to fix this for days and have not found a solution other than removing the picture or link which is not an option for me due to requirements.
Thanks in advance.

How to pass parameters to Facebook, fb://publish/?

From my iOS app, I want to open the Facebook application to make a post in the user wall. I want to give a predefined text to make the post, and I don't know how to add the text to the call.
NSString *post = [NSString stringWithFormat:#"fb://publish"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:post]];
How could I pass the text parameters with the "fb://publish/" option?
From Safari, some HTML like this seems to be working:
...
It opens up the Facebook application's share dialog with the text predefined, which you have to edit before you can actually share it. You can also include URLs into the text; Facebook converts that to a simple link once posted, but it does not add the image or any other meta details defined on that URL, as usual.
Note this redirects to the old style publish screen,
not the one the Facebook application has been using since version 3.4.
First install the Facebook API and try this code...
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
FBAppID, #"130506840369385",
#"http://developers.facebook.com/docs/reference/dialogs/", #"link",
#"http://fbrell.com/f8.jpg", #"picture",
#"Facebook Dialogs", #"name",
#"sdsdds", #"caption",
#"asdasdasd", #"description",
#"hi goolwihdfkasnv", #"message",
nil];
[facebook dialog:#"feed" andParams:params andDelegate:self];
For posting status to facebook use this URL:fb://publish/profile/me?text=foo

How to post a string and an image using facebook api for ios

i have a ui image and a nsstring .How do i post it to the the wall of a user using fb api for ios.
You need to upload an image somewhere, in order to obtain an image url. once you have the url, you can post it something like:
[_facebook requestWithGraphPath:#"feed"
andParams:[NSMutableDictionary dictionaryWithObjectsAndKeys: FEED_MESSAGE, #"message",
IMAGE_URL, #"picture",
LINK, #"link",
name, #"name",
description, #"description", nil]
andHttpMethod:#"POST"
andDelegate:self];
Note that the "picture" key is the actual url of the image, whereas "link" key is the url opened when an image is clicked.

Resources