我正在尝试获取页面的访问令牌,因此我按照Facebook上的文档进行操作。我想在用户登录时请求许可,这是我的代码:
#import "ViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
// Optional: Place the button in the center of your view.
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends", @"user_birthday"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我刚刚创建了一个登录按钮,当用户登录时会询问权限, 之后,我可以获得public_file,email,user_friends,user_birthday。
但是我也想在用户登录时请求manage_pages的许可,以便我可以拥有页面的访问令牌,我该怎么做呢?
答案 0 :(得分:0)
我明白了,只需添加:
loginButton.publishPermissions = @[@"manage_pages"];
现在用户登录时会要求许可。