我无法使用facebook 3.1 ios sdk中的发布权限登录.
我的应用程序有一个共享视频的按钮,当用户点击它时,我想添加基本+发布权限.据我了解,我必须做两个电话 -
openActiveSessionWithReadPermissions, 然后reauthorizeWithPublishPermissions这是我现在使用的代码:
//Opens a Facebook session and optionally shows the login UX.
- (void)openSessionForReadPermissions
{
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
//this is called even from the reauthorizeWithPublishPermissions
if (state == FBSessionStateOpen && !error)
{
[self openSessionForPublishPermissions];
}
else if (state == FBSessionStateClosedLoginFailed)
{
[FBSession.activeSession closeAndClearTokenInformation];
[[NSNotificationCenter defaultCenter] postNotificationName:FBLoginErrorNotification object:session];
}
}];
}
-(void)openSessionForPublishPermissions
{
NSArray* permissions = [NSArray arrayWithObject:@"publish_stream"];
[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:
^(FBSession …Run Code Online (Sandbox Code Playgroud)