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.
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
© 2024 OneMinuteCode. All rights reserved.