2016-09-12 37 views
0

我試圖獲取頁面的訪問令牌,所以我跟着Facebook上的文檔。我想問的許可時,用戶登錄,這裏是我的代碼:如何在iOS上獲得Facebook的manage_pages權限開發?

#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

好吧....將它添加到你的權限列表? – luschn

+0

我試過了,但不是那麼簡單..... –

回答

0

我得到了它,只需添加:

loginButton.publishPermissions = @[@"manage_pages"]; 

,現在它會要求允許在用戶登錄。

相關問題