您多久之前更新了您的 facebook API?大约两周前,我不得不删除我的整个 API,重新下载并更改我的应用程序使用的所有发布代码。它完全停止工作,直到应用程序用户抱怨才知道。新 facebook API 的一些必要更改:
如果您查看最新的示例应用程序,Facebook 建议将这些放在您的 appDelegate 中。
    #import <FacebookSDK/FacebookSDK.h>
     - (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
        NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil];
                return [FBSession openActiveSessionWithPermissions:permissions
                                                      allowLoginUI:allowLoginUI
                                                 completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
     if(state==513){
                   //facebook usage has been approved
                   }
                   }];
            }    
     - (BOOL)application:(UIApplication *)application
                        openURL:(NSURL *)url
              sourceApplication:(NSString *)sourceApplication
                     annotation:(id)annotation {
                // We need to handle URLs by passing them to FBSession in order for SSO authentication
                // to work.
                return [FBSession.activeSession handleOpenURL:url];
            }
无论你想在哪里发帖,都可以放这样的东西:
    if(facebookEnabled==YES)
    {
     NSString *fbText=[NSString stringWithFormat:@"whatever text you want to post";
            [FBRequestConnection startForPostStatusUpdate:fbText
                                        completionHandler:^(FBRequestConnection *connection, id result, NSError *error) 
{
                                                                                    }];
    }
如果您有任何问题,请告诉我。希望能帮助到你!