2015-08-19 77 views
0

我與解析的Anypic exprimenting和我不斷收到這3個錯誤:解析Anypic Facebook登錄錯誤

Presenting view controllers on detached view controllers is discouraged <PAPWelcomeViewController> 

然後去

Unbalanced calls to begin/end appearance transitions for <UINavigationController> 

最後

Login failure. FB Access Token or user ID does not exist 

我設置一切就像在教程中所述。它過去運行良好,但我沒有收到這些錯誤,但是當我在一段時間後回到項目中時,我正在獲得這些錯誤。

他們正在嘗試通過Facebook登錄到應用程序時發生。我選擇登錄,把我的細節,點擊登錄,然後沒有任何反應,它只是回到「登錄Facebook」按鈕。

感謝您的幫助!

+0

你可以分享你的代碼的基本位取? – lenz

+0

一切都很默認。我剛剛在AppDelegate.m中添加了Parse Applictation ID和客戶端密鑰,並在info.plist中添加了facebook應用詳細信息 – rafra

+0

任何想法可能會出錯? – rafra

回答

1

你應該嘗試改變handleFacebookSession看起來像這樣:

- (void)handleFacebookSession { 
if ([PFUser currentUser]) { 
    if (self.delegate && [self.delegate respondsToSelector:@selector(logInViewControllerDidLogUserIn:)]) { 
     [self.delegate performSelector:@selector(logInViewControllerDidLogUserIn:) withObject:[PFUser currentUser]]; 
    } 
    return; 
} 

NSArray *permissionsArray = @[ @"public_profile", 
           @"user_friends", 
           @"email"]; 

self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 

// Login PFUser using Facebook 
[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) { 

    if (!user) { 
     NSString *errorMessage = nil; 
     if (!error) { 
      NSLog(@"Uh oh. The user cancelled the Facebook login."); 
      errorMessage = @"Uh oh. The user cancelled the Facebook login."; 
     } else { 
      NSLog(@"Uh oh. An error occurred: %@", error); 
      errorMessage = [error localizedDescription]; 
     } 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In Error" 
                 message:errorMessage 
                 delegate:nil 
               cancelButtonTitle:nil 
               otherButtonTitles:@"Dismiss", nil]; 
     [alert show]; 
    } else { 
     if (user.isNew) { 
      NSLog(@"User with facebook signed up and logged in!"); 
     } else { 
      NSLog(@"User with facebook logged in!"); 
     } 

     if (!error) { 
      [self.hud removeFromSuperview]; 
      if (self.delegate) { 
       if ([self.delegate respondsToSelector:@selector(logInViewControllerDidLogUserIn:)]) { 
        [self.delegate performSelector:@selector(logInViewControllerDidLogUserIn:) withObject:user]; 
       } 
      } 
     } else { 
      [self cancelLogIn:error]; 
     } 
    } 
}];} 

溶液從here