开发者

write a message on wall of facebook using my iphone application

开发者 https://www.devze.com 2022-12-30 11:26 出处:网络
I am making an iphone game , In that I want to upload score on face book. I am new to face book 开发者_高级运维codes, I\'ve got it\'s API from github.com. But I don\'t know how to write or post direct

I am making an iphone game , In that I want to upload score on face book. I am new to face book 开发者_高级运维codes, I've got it's API from github.com. But I don't know how to write or post directly my message on wall of face book of log in account else how to share my score on facebook. I've done log in portion. Can any one help me????


Please refer the facebook api development at http://wiki.developers.facebook.com/index.php/Facebook_iPhone_SDK

Sample application also given by facebook for iPhone.

Thanks,
Jim.


Assuming the user has allready logged in and you have a vaild faceb0ok session, you could use something like this to get you started:

- (void) post {
    postingDialog = [[[FBStreamDialog alloc] init] autorelease];
    postingDialog.delegate = self;
    postingDialog.userMessagePrompt = @"Prompt the User:";

    NSString *name = @"Name of thing"
    NSString *href = @"http://www.example.com"

    NSString *caption = @"This is a caption"
    NSString *description = @"This is a description";
    NSString *imageSource = @"http://example.com/1.png";
    NSString *imageHref = @"http://example.com/1.png";

    NSString *linkTitle = @"Link title";
    NSString *linkText = @"Text";
    NSString *linkHref = @"http://www.example.com/iphone";
    postingDialog.attachment = [NSString stringWithFormat:
                                @"{ \"name\":\"%@\","
                                "\"href\":\"%@\","
                                "\"caption\":\"%@\",\"description\":\"%@\","
                                "\"media\":[{\"type\":\"image\","
                                "\"src\":\"%@\","
                                "\"href\":\"%@\"}],"
                                "\"properties\":{\"%@\":{\"text\":\"%@\",\"href\":\"%@\"}}}", name, href, caption, description, imageSource, imageHref, linkTitle, linkText, linkHref];
    [postingDialog show];
}
0

精彩评论

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