2010-05-14 76 views
2

我正在製作一款iphone遊戲,因爲我想在臉書上上傳分數。我是新來面對書代碼,我從github.com得到它的API。但是我不知道如何直接在登錄帳戶的牆上寫信或發佈我的消息,或者如何在Facebook上分享我的分數。我已完成登錄部分。 任何人都可以幫助我嗎?使用我的iphone應用程序在Facebook牆上寫消息

回答

1

假設用戶已經登錄媒體鏈接中,你有一個vaild faceb0ok會話,你可以使用這樣的事情,讓你開始:

- (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

感謝Buddy ....現在讓我來實現它。 – 2010-05-14 08:07:37

相關問題