- (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.
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.
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.
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];
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];