過去に 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 で共有してくれてありがとう」などのメッセージを投稿したいとします。