How to set user read permission on FBLoginview in ios?

I use the Facebook SDK and FBLoginViewto log in to Facebook, and I have the basic information about the user, but I need more permissions, such as email, birthday. How to add permissions?

+5
source share
2 answers
FBLoginView *loginView = [[FBLoginView alloc] init];
loginView.readPermissions = @[@"email", @"user_likes"];
+12
source

Try the following:

    - (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];
                 }];
    }

Call this method with YES, you can give another permission, for example

[[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];
+3
source

All Articles