posting on facebook newsfeed is not working - iphone

i am running hackbook sample for iphone using facebook sdk but when i try to publish on my newsfeed it is posting on my timeline but it is not showing in my newsfeed . i tried another example from this facebook example link but it is also posting on my timeline but not in my newsfeed.the code for publishing using hackbook sample is
- (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];
}
anybody else has face this type of issue
any suggestions will be great help

Try using the OFFICIAl iOS dev tutorial made by Facebook themselves:
iOS Tutorial

Related

How to make a friend request with facebook ios sdk?

i'm using the facebook iOS sdk.
I need to send friend requests between users of facebook, from an iOS app.
I know that can not be sent via graph API. I'm trying to through dialog of facebook i do not know how.
Can anyone help me?
This is my code:
Facebook *face = [[Facebook alloc] initWithAppId:#"APP_ID" andDelegate:self];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"user_id", #"id",
nil];
[face dialog:#"me/friends"
andParams:params
andDelegate:self];
With this code i get a dialog with this text: "The page you requested was not found"
Ok I found a solution.
I have created a NSMutableDictionary to make a "appRequest" with their corresponding parameters but finally indicated that the type of dialogue is a "friends".
It's a strange solution but it works.
Facebook *face = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil];
face.accessToken = FBSession.activeSession.accessToken;
face.expirationDate = FBSession.activeSession.expirationDate;
if ([face isSessionValid]){
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"My Title", #"title",
#"Come check out my app.", #"message",
userId, #"id",
nil];
[face dialog:#"friends"
andParams:[params mutableCopy]
andDelegate:nil];
}
This may help you
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, #"message", title, #"title", nil];
[[self facebook] dialog: #"apprequests"
andParams: [params mutableCopy]
andDelegate: delegate];
See this question for further details and also this document.

iOS Integration with Facebook - Publishing in the news feed

I don'y know if here is the right place to ask that, but i'm pretty sure that some of you already experienced some kind of iOS integration with Facebook.... Then I'll try to explain what i'm trying to do here....
I've already connected my app with facebook following the documentation in Developers.facebook..... The thing is.... I have a button in my app that should trigger the dialog box that allows me to publish in my news feed.... The problem is that the information in the documentation doesn't work (Or I don't know how to use it...)....
The orientation there is to use that code to trigger the action:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"https://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",
#"Facebook Dialogs are so easy!", #"message",
nil];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
But that's a lot of things missing on the information, like: where should I use that code and how exactly....
Someone have already done that kind of thing?
Thanks!!!
The only thing you should do for this to work is make an IBAction an couple it in the Xib to the button and behaviour you want.
it would look something like this :
-(IBAction) sendMessageToWall
{
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"https://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",
#"Facebook Dialogs are so easy!", #"message",
nil];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
}

Tagging Photos via Facebook GraphAPI

Facebook recently added photo-tagging capabilities to its Graph API:
http://developers.facebook.com/blog/post/509/
I am using FbConnect on iPhone to upload a picture and tag my page inside it.
So, my first call is:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.imageToPost, #"picture",
#"My caption!", #"name", #"tags",
nil];
[self.theFacebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
This correctly returns:
{
id = 2092859844825;
}
Then I make another call:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
FACEBOOK_PAGE_ID,#"to",
#"160",#"x",
#"240",#"y",
nil];
[self.theFacebook requestWithGraphPath:[NSString stringWithFormat:#"%#/tags",photoId]
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
Then I get:
{contents = "OAuthException"}
{contents = "(#121) Invalid photo id"}
But what ID does it expect from me?
Submitting the same request in GET method, it doesn't give the error, so I think the id is correct. Any ideas??
What permissions do you have set? Check you have the user_photos permission

How to include a link in my feed-post using FBConnect from iPhone app?

I've got some code that does a bunch of set-up, then posts to Facebook using FB-connect. At one point, I have something like this:
NSString *description =
#"Wow, what a great app! "
#"Download it free: "
#"<a href=\"http://itunes.apple.com/us/app/myApp/id12345?mt=8\">"
#"On iTunes AppStore."
#"</a>"
;
// post FB dialog
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// #"This is what I say about myApp:", #"message", // user msg
#"MyApp!", #"name", // Bold/blue name
#"MyApp is cool!", #"caption", // 1st line
description, #"description", // 2nd line
#"http://itunes.apple.com/us/app/myApp/id12345?mt=8", #"link",
#"http://farm6.static.flickr.com/5230/5576336654_075c2abcf9_s.jpg", #"picture",
nil];
[facebook dialog: #"feed"
andParams: params
andDelegate: self];
And it ALMOST works! The only problem is: in my description string, everything between "<a href..." and "</a>" doesn't display on my facebook wall.
So the question is: how do I add a link (anchor-tag style) as part of my post?
It is not possible to add links in the description, however you can achieve the same result using the "properties" and "actions" keys, as documented here:
Facebook API Feed Dialog Documentation
The code would be as follows:
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary *propertyvalue = [NSDictionary dictionaryWithObjectsAndKeys:#"On iTunes AppStore", #"text", #"http://itunes.apple.com/us/app/myApp/id12345?mt=8", #"href", nil];
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:propertyvalue, #"Download it free:", nil];
NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:#"Download it free", #"name",#"http://itunes.apple.com/us/app/myApp/id12345?mt=8", #"link", nil];
NSString *finalproperties = [jsonWriter stringWithObject:properties];
NSString *finalactions = [jsonWriter stringWithObject:actions];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
userfbid, #"to",
#"http://itunes.apple.com/us/app/myApp/id12345?mt=8", #"link",
#"http://farm6.static.flickr.com/5230/5576336654_075c2abcf9_s.jpg", #"picture",
#"Name name name", #"name",
#"Caption caption caption", #"caption",
#"Description description description", #"description",
finalproperties, #"properties",
finalactions, #"actions",
nil];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
The properties will appear in the stream attachment beneath the description, with each property on its own line.
The actions will appear next to the "Comment" and "Like" link under posts.
In the attached screenshots you will see how both properties and actions look like.
The first screenshot shows how it looks when the dialog pops up on the iPhone.
The second screenshot shows the Facebook post with the properties object.
The third screenshot shows the Facebook post with both the properties and actions objects.
Hope this helps.
#lancelotavery gave the correct answer, and I accepted it. I had just moments before discovered the properties field and was coming back to enter this answer when I saw his.
I am entering this answer only to demonstrate that the desired behaviour can be done without adding a jsonwriter.
As expected, this was one of those things that's super-easy, once you know the trick.
The answer is: you can't put HTML in your description field.
HOWEVER, the facebook dialog accepts a parameter called "properties", which can be either a string or a string-representation of another dictionary, which can have exactly 2 values, TEXT and HREF. So, adding a line like this one:
NSString* propString = #"{\"Download it free: \":{\"href\":\"http://bit.ly/12345\",\"text\":\"On iTunes AppStore\"}}";
and then inserting this pair into params:
propString, #"properties",
made everything work. So the final edit of my code from above looks something like this:
NSString *description =
#"Wow, what a great app! "
#"Download it free: "
#"<a href=\"http://itunes.apple.com/us/app/myApp/id12345?mt=8\">"
#"On iTunes AppStore."
#"</a>"
;
NSString* propString = #"{\"Download it free: \":{\"href\":\"http://bit.ly/12345\",\"text\":\"On iTunes AppStore\"}}";
// post FB dialog
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// #"This is what I say about myApp:", #"message", // user msg
#"MyApp!", #"name", // Bold/blue name
#"MyApp is cool!", #"caption", // 1st line
description, #"description", // 2nd line
#"http://itunes.apple.com/us/app/myApp/id12345?mt=8", #"link",
#"http://farm6.static.flickr.com/5230/5576336654_075c2abcf9_s.jpg", #"picture",
propString, #"properties",
nil];
[facebook dialog: #"feed"
andParams: params
andDelegate: self];

iphone : FBConnect Auto post to user wall

i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?
the following should be called in the class that implements FBSessionDelegate and FBRequestDelegate:
Facebook *_facebook = [[Facebook alloc] initWithAppId:kAppId];
NSArray *_permissions = [[NSArray arrayWithObjects:
#"read_stream", #"offline_access",nil] retain];
[_facebook authorize:_permissions delegate:self];
And that is the call for fb post (should be used in the same class):
NSString *message = #"This is the message I want to post";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, #"message",
nil];
[_facebook requestWithMethodName:#"stream.publish"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
If you want to post a message on the wall of other user you should include "uid" parameter in your params dictionary. Please consult http://developers.facebook.com/docs/reference/rest/stream.publish/
P.S. There are all the necessary examples in the iPhone Facebook connect SDK sample code, so please do not afraid to investigate just a little bit ;)