开发者

Is it possible to publish a story on user's wall without making an app on facebook?

开发者 https://www.devze.com 2023-02-14 09:26 出处:网络
i am working with an iphone app.开发者_高级运维 its a nav based app. in every DetailVew there is a button for publishing some information on user\'s facebook wall. It ll be link and some information.

i am working with an iphone app.开发者_高级运维 its a nav based app. in every DetailVew there is a button for publishing some information on user's facebook wall. It ll be link and some information. how can i do that? in developer.facebook.com they have explained steps to do that but in those steos they need facebook app id. i dont have any app against my iphone app on facebook. is it possible to just publish story on facebook wall without having a facebook app? thanx


Yes, it's possible. You'll still need to create a Facebook app if you want to output a story in a custom format but if you just want to output a headline and story, with maybe a link or a picture, there's no need. The code I use looks something like this:

SBJSON *jsonWriter = [[SBJSON new] autorelease];

NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            [name stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"name",
                            [description stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"description",
                            [url stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"XXX", @"api_key",
                               @"Share on Facebook",  @"user_message_prompt",
                               attachmentStr, @"attachment",
                               nil];

[facebook dialog:@"stream.publish" andParams:params andDelegate:self];

This is using the newer Facebook iOS API rather than the older FacebookConnect API.

0

精彩评论

暂无评论...
验证码 换一张
取 消