我想在 iOS6 上发布 Facebook。我这样做的方式:
- 请求阅读权限
- 请求发布许可
- 调用 [FBDialogs presentOSIntegratedShareDialog...]
它可以工作,但在提要中我看到“通过 iOS”,我想看到我的应用程序名称。如何修复?如果我使用 Feed Dialog(基于 Web)发布 - 我的应用程序名称显示正确
- (IBAction)facebookShareButtonTaped:(id)sender
{
[FBSession openActiveSessionWithReadPermissions:@[@"email"]
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error)
{
if (status == FBSessionStateOpen)
{
[FBSession.activeSession requestNewPublishPermissions:@[@"publish_actions"] defaultAudience:FBSessionDefaultAudienceOnlyMe completionHandler:^(FBSession *session, NSError *error) {
[self sendFacebookPost];
}];
}
}];
}
- (BOOL)sendFacebookPost
{
BOOL dialogShown = [FBDialogs presentOSIntegratedShareDialogModallyFrom:self initialText:@"" image:nil url:nil handler:^(FBOSIntegratedShareDialogResult result, NSError *error) {
if (error && [error code] == 7)
{
return;
}
if (error)
{
[self showAlert:[self checkErrorMessage:error]];
}
else if (result == FBNativeDialogResultSucceeded)
{
[self showAlert:@"Posted successfully."];
}
}];
return dialogShown;
}