5

我使用 Facebook SDK 并FBLoginView登录 Facebook 并获得了基本用户信息,但我需要更多权限email,例如birthday. 如何添加权限?

4

2 回答 2

12
FBLoginView *loginView = [[FBLoginView alloc] init];
loginView.readPermissions = @[@"email", @"user_likes"];
于 2013-04-24T09:54:11.370 回答
3

尝试这个:

    - (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {

             NSArray *permissions = [[NSArray alloc] initWithObjects: @"email", nil];
                 return [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:allowLoginUI completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
             [self sessionStateChanged:session state:state error:error];
                 }];
    }

用 调用此方法YES,您可以授予不同的权限,例如

[[NSArray arrayWithObjects:
                            @"email",
                            @"user_birthday",
                            @"user_likes",
                            @"user_location",
                            @"user_photos",
                            @"read_stream",
                            @"publish_stream",
                            @"publish_actions",
                            @"status_update",
                            @"user_about_me",
                            @"read_friendlists",
                            @"friends_about_me",
                            @"friends_birthday",
                            @"friends_photos",
                            nil] retain];
于 2013-04-24T07:17:13.210 回答