After logging in to Facebook, instead of simply disappearing and showing my application, the page is updated and remains empty, and from the exits we only have the opportunity to press the "DONE" button, which cancels the authorization.

UPDATE : when checking on iOs 8.4 firmware, everything happens normally, and the application opens on its own, but still, when checking the result, it has a canceled status (result.isCencelled = true)

And it is also noted that an error is issued in the console: "an active access token should be used." that is, loggin inn does not happen, although everything seems to be done according to the template proposed by Facebook.

Adding a button:

fbButton = FBSDKLoginButton() //FACEBOOK Button fbButton.frame = CGRectMake(0,0,CGFloat(width),CGFloat(91)) fbButton.readPermissions = ["public_profile","email","user_friends"] fbButton.delegate = self fbView.addSubview(fbButton) 

The execution method specified by the delegate:

 func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) { if ((error) != nil) { //handle error print("Houston, we have a PROBLEM") } else { returnUserData() } } 

Method for returning user data (now used to check the presence of a token, which is always missing):

 func returnUserData() { if (FBSDKAccessToken.currentAccessToken() != nil){ if FBSDKAccessToken.currentAccessToken().hasGranted("email") { print("Houston, we have an EMAIL") } else { print("Houston, we have a PROBLEM") } } else { print("Houston, we even have no TOLEN") } } 

enter image description here

enter image description here

EDIT: Yes, that's what was added to plist.info:

 <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb**********</string> // я ввел свое значение <string>fbauth2</string> // без этой строки выбирало </array> // ошибку связанную с fbauth2 </dict> </array> <key>FacebookAppID</key> <string>****************</string> // я ввел свое значение <key>FacebookDisplayName</key> <string>EnglishFor</string> <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>facebook.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>fbcdn.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>akamaihd.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> </dict> </dict> <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> 

    1 answer 1

    It was the same) It is necessary to add in AppDelegate.swift

     func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { return ApplicationDelegate.shared.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } 
    • I solved the problem myself, it is not known why, but thank you for your attention!) - KostiaZzz