ios - Unable to login on loading FBLoginView -


I am using Facebook SDK for the first time in iOS. I tried to follow the Facebook documentation to enter the user: and

I pressed a button to prompt the user for login FBLoginView New View Controller I'm going to face the issue that after created FBLoginView , I'm immediately taking the two to FBLoginViewDelegate method: loginViewShowingLoggedOutUser: < / Strong> and loginView: handleError:

loginView: handl EError: as the error FBErrorCategoryUserCancelled , I never canceled a request! Modal popup is displayed for 2 seconds for login, then automatically dismisses with the status of the trash.

I am really unable to understand why this is happening. I am testing it on the simulator for the integration of Facebook SDK There are all 3 keys required in the plist file. Why is the request canceled automatically? Please help me with this issue .. Thanks

Code:.

  #import "FBLoginViewController.h" FBLoginViewController @interface () @end @ implementation FBLoginViewController - (minus) Drishydidlod {[super Wudidlod]; // no additional setup after loading the view from my nib FBLoginView * loginview = [[FBLoginView alloc] initWithReadPermissions: [NSArray arrayWithObjects: @ "basic_info", @ "user_photos", @ "friend_photos", nil]]; Loginview.frame = CGRectOffset (loginview.frame, (self.view.center.x - (loginview.frame.size.width / 2)), 5); Loginview.delegate = self; [Self.view addSubview: loginview]; } #pragma mark - FBLoginDelegate - (minus) loginViewFetchedUserInfo: (FBLoginView *) loginView user: (ID & lt; FBGraphUser & gt;) User {NSLog (@ "user information:% @", user); } - (zero) loginViewShowingLoggedInUser: (FBLoginView *) login view {nslog (@ "user login"); } - (zero) loginViewShowingLoggedOutUser: (FBLoginView *) loginView {NSLog (@ "user logout"); // log on console} - (zero) loginView: (FBLoginView *) loginView handleError: (NSError *) Error {NSString * Alert Message; * Warning Title; // If the user should perform the action outside of your app, then // will provide a message to the SDK user, you need to see it // It easily handles matters such as Facebook password change or unverified Facebook account is. If ([FBErrorUtility should NotifyUserForError: error]) {alertTitle = @ "Facebook error"; Warning message = [FBErrorUtility userMessageForError: error]; // This code handles the session shutdown of the app. // You can take a look at our error handling guide to learn more about this // https://developers.facebook.com/docs / ios / errors} if ((FBErrorUtility Trutigar: category error: error] == FBErrorCategoryAuthenticationReopen session) {alertTitle = @ "session error"; AlertMessage = @ "Your current session is no longer valid, please log in again." // If the user has canceled the login, You can also choose to show a message to the user, if the login is canceled then the user will not be able to fulfill them, which you started in your app (such as up to FB-stored information accessing or posting on Facebook)} Else if ([FBErrorUtility error CategoryForError: error] == FBErrorCategoryUserCancelled) for simplicity // {NSLog (@ "user canceled login"), it sampled the other errors with a common message S Balta is / are to our error handling probe guide // More details // https://developers.facebook.com/docs/ios/errors} else {alertTitle = @ "something went wrong"; AlertMessage = @ "Please try again later."; NSLog (@ "unexpected error:% @", error); } If (Alert Message) {[[[UIAlertview Alok] Init Withhealth: Alerttile Message: Alert Message Representative: Zero Cancel: Titanium: @ "OK" Other Buttonats: Zero] Show]; }} @end  

Strange, but it worked for me

< pre> FBLoginView * loginview = [[FBLoginView alloc] initWithReadPermissions: [NSArray arrayWithObjects: in viewDidLoad, I FBLoginView to change the initialization of the @ "basic_info", @ "user_photos", @ "Mitr_fotos" , Zero]]; For

:

  FBLoginView * loginview = [[FBOGIN view light] init];  

Starting with no permission, modal popup is now being brought for login.


Comments