2011-09-09 11 views
1

私が取り組んでいるiPhoneアプリでFacebookの壁の投稿を実装しようとしています。Facebook iPhone SDK - 自動的にPublishSteam(壁紙に投稿するダイアログをバイパス)

「壁に投稿」ダイアログボックスをバイパスして、そのまま送信するにはどうすればよいですか?
基本的に私はただのURLを投稿しようとしています。私は本当に人々に "何かを書く"というテキストボックスを見せたくありません。

これは私がこれまでに持っていたコードです(サンプルアプリケーションから)。

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

NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
          @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil]; 

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
          @"a long run", @"name", 
          @"The Facebook Running app", @"caption", 
          @"it is fun", @"description", 
          @"http://itsti.me/", @"href", nil]; 
NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
          @"Share on Facebook", @"user_message_prompt", 
          actionLinksStr, @"action_links", 
          attachmentStr, @"attachment", 
          nil]; 


[_facebook dialog:@"feed" 
     andParams:params 
    andDelegate:self]; 

ちょうどFacebookのクラスの- (FBRequest*)requestWith...インスタンスメソッドのいずれかを使用し、
ティー

答えて

3

、ありがとうございました。

古いREST APIを使用したシンプルな壁のポスト:

NSString *facebookStatusMessage = @"facebookStatusMessage"; 
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           facebookStatusMessage, @"status", 
           nil]; 

FBRequest *request = [_facebook requestWithMethodName:@"status.set" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

それはREST APIは廃止れますよう- (FBRequest*)requestWithGraphPath:とFacebookのグラフAPIを使用することをお勧めします。

- (void)request:(FBRequest *)request didFailWithError:(NSError *)error { 
} 

- (void)request:(FBRequest *)request didLoad:(id)result { 
    // result may be a dictionary, an array, a string, or a number, 
    // depending on the format of the API response 
} 

その後もFBRequestDelegateプロトコルの一部を実装

関連する問題