0

過去に addThis と share kit を使用していましたが、問題が発生するのにうんざりしていました。私は最終的にFacebook SDKを調べて、それを機能させました。これを使用して、ユーザーのウォールに投稿しています...

-(IBAction)fbPost:(id)sender
{
if (![facebook isSessionValid]) {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"user_likes", 
                            @"read_stream",
                            @"publish_stream",
                            nil];
    [facebook authorize:permissions];

}


SBJSON *jsonWriter = [SBJSON new];

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

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"Name", @"name",
                            @"Test Caption", @"caption",
                            @"This sure is fun", @"description",
                            @"http://www.test.com/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@“xxxxxxxxxx",@"app_id",
                               @"Share on Facebook",  @"user_message_prompt",
                               actionLinksStr, @"action_links",
                               attachmentStr, @"attachment",
                               @"Here is the message",@"message",
                               nil];

AppDelegate *aDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[aDelegate.facebook dialog:@"stream.publish" andParams:params andDelegate:self];
}

私の質問は... ユーザーが自分のウォールに投稿したことを伝える方法はありますか? たとえば、「Facebook で共有してくれてありがとう」などのメッセージを投稿したいとします。

4

1 に答える 1

2

私はiOS開発者ではありませんが、FBDialogDelegateのドキュメントdialogDidCompleteから、ユーザーが次の方法で投稿したことを知ることができるようです。

このメソッドは、ダイアログが成功し、非表示になりそうになった後に呼び出されます。このメソッドを使用して、ダイアログフローの成功パスを処理できます。

他の方法をチェックして、ユーザーがキャンセルしたか、エラーが発生したかを確認することもできます。

ダイアログを渡しているように見えますself。そこにそれらのメソッドを実装するだけです。

于 2012-06-03T22:26:41.903 に答える