If you press OK on the Facebook approval screen, the screen turns white and nothing happens.

Asked 2 years ago, Updated 2 years ago, 63 views

I am currently creating a function to post articles on Facebook, and I am executing the following code to log in to Facebook when I press the button.

 if(FBSDKAccessToken.currentAccessToken()!=nil){

        } else{
            let login —FBSDKLoginManager=FBSDKLoginManager()
            login.logInWithReadPermissions(["email", fromViewController:self.viewController, handler:{(result:FBSDKLoginManagerLoginResult!, error:NSError!) ->Voidin

                if error!=nil{
                    print("error!")
                    FBSDKLoginManager().logOut()
                } else if result.isCancelled {
                    print("cancelled!")
                    FBSDKLoginManager().logOut()
                } else{
                    print("success!")
                }
            })
        }

As mentioned above, I implemented Facebook login function, but when I pressed OK button in the lower right corner of the screen when the login (approval?) screen appears, and then when I think about flying to another page, the page remains white and nothing has been displayed since then.
Moreover, there is no handling such as errors, so I don't know what to do at all.
Why is the screen still white?Is it possible to log in?
If anyone knows, please let me know how to solve this problem.
Thank you for your cooperation.

ios swift facebook

2022-09-30 21:02

1 Answers

AppDelegate.swift should be as follows:

import UIKit
import FBSDKCoreKit
import FBSDKLoginKit

@UIAapplicationMain
classAppDelegate:UIResponder,UIApplicationDelegate{

var window —UIWindow?


func application(application:UIApplication, didFinishLaunchingWithOptions launchOptions:[NSObject:AnyObject]?) ->Bool{
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(application:UIApplication, openURL url:NSURL, sourceApplication:String?, announcement:AnyObject) - >Bool{
    return FBSDKApplicationDelegate.sharedInstance().application(application,openURL:url,sourceApplication:sourceApplication,announcement)
}

omission


2022-09-30 21:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.