FBConnect: “The user hasn't authorized the application to perform this action”

前端 未结 3 1495
渐次进展
渐次进展 2021-01-22 10:37

I m developing an iPhone app which includes facebook wall posting.After log in, I post to user\'s wall by following code:

NSString *appIcon = [NSString stringWit         


        
3条回答
  •  半阙折子戏
    2021-01-22 11:06

    I have Found the solution of the problem by myself.

    Actually the cause of the problem is the application doest have permission to "Post To Wall". (publish_stream).Hence FB was denying with following error.

    "The user hasn't authorize this application to perform this action".

    So when user logs in, Ask user to give permission of publish_stream,

    - (void)session:(FBSession*)session didLogin:(FBUID)uid {
    
        FBPermissionDialog *permissions = [[FBPermissionDialog alloc]initWithSession:_session];
        permissions.permission = [NSString stringWithString: @"publish_stream"]; 
        [permissions show];
    
    }
    

    `
    When once the user have allowed "Post to wall", this dialog wont appear ever again.

提交回复
热议问题