0
我正在使用臉書登錄實施應用程序。我需要訪問用戶「公開個人資料」,以及「電子郵件ID」也。這裏電子郵件ID是必須的。我可以登錄,但在輸入登錄詳細信息後,它會顯示審查頁面,在該審閱頁面中顯示「您提供的編輯信息」按鈕,在這裏我正面臨問題。我在這裏有2個疑問1)是否可以禁用「編輯您提供的信息」選項(或)2)是否可以禁用用戶交互電子郵件字段,如公共配置文件。我的代碼在下面。在iOS上使用最新的SDK登錄Facebook的問題
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self toggleHiddenState:YES];
self.lblLoginStatus.text = @"";
self.loginButton.delegate = self;
self.loginButton.readPermissions = @[@"public_profile",@"email"];
}
#pragma mark - Private method implementation
-(void)toggleHiddenState:(BOOL)shouldHide{
self.lblUsername.hidden = shouldHide;
self.lblEmail.hidden = shouldHide;
self.profilePicture.hidden = shouldHide;
}
#pragma mark - FBLoginView Delegate method implementation
-(void)loginViewShowingLoggedInUser:(FBLoginView *)loginView{
self.lblLoginStatus.text = @"You are logged in.";
[self toggleHiddenState:NO];
}
-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user{
NSLog(@"%@", user);
self.profilePicture.profileID = user.id;
self.lblUsername.text = user.name;
self.lblEmail.text = [user objectForKey:@"email"];
}
-(void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView{
self.lblLoginStatus.text = @"You are logged out";
[self toggleHiddenState:YES];
}
-(void)loginView:(FBLoginView *)loginView handleError:(NSError *)error{
NSLog(@"%@", [error localizedDescription]);
}
你能解釋一下嗎?我們如何在這裏得到結果。我正在這樣做。 – 2015-02-11 12:53:55
[FBSession openActiveSessionWithReadPermissions:@ [@ 「public_profile」,@ 「電子郵件」,@ 「user_friends」] allowLoginUI:YES completionHandler: ^(FBSession *會話,FBSessionState狀態,NSError *錯誤){ //檢索應用程序委託 AppDelegate * appDelegate =(AppDelegate *)[UIApplication sharedApplication] .delegate; [appDelegate sessionStateChanged:session state:state error:error]; }]; – 2015-02-11 13:01:07
只需在'openActiveSessionWithReadPermissions'內添加'FBRequestConnection'塊,然後在'FBRequestConnection'塊內檢查'if(emailPermission){//然後訪問被授予} else {//顯示一個alertview並告訴用戶他應該給予權限到他的電子郵件地址}' – trimi 2015-02-11 13:13:15