Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login always cancel iOS 13 Xcode 11 Beta 3 #482

Closed
danielghre opened this issue Jul 1, 2019 · 22 comments

Comments

@danielghre
Copy link

commented Jul 1, 2019

Checklist

  • I've updated to the latest released version of the SDK 5.2.1
  • I've searched for existing [GitHub issues]
  • I've looked for existing answers on [Stack Overflow]
  • I've read the Code of Conduct
  • This issue is not security related and can safely be disclosed publicly on GitHub

Environment

  • Xcode Version: 11.0 Beta 3
  • iOS Version: 13 Beta 3
  • Swift Version: 5.1
  • Installation Platform & Verison: CocoaPods

Goals

Login With Facebook

Expected Results

Open Safari or app to perform login

Actual Results

Login always return cancel in the console, the error is nil

Steps to Reproduce

Tap on the login button

Code Samples & Details

AppDelegate :

import FBSDKCoreKit
import Firebase
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()  
    return ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return ApplicationDelegate.shared.application(app, open: url, options: options)
}

Login Button code :

import FBSDKLoginKit
import FacebookLogin
@objc func didTapFacebookButton() {
    let loginManager = LoginManager()
    loginManager.logIn(permissions: ["public_profile"], from: self, handler: { result, error in

        guard let result = result else {
            print("No result found")
            return
        }
        if result.isCancelled {
            print("Cancelled \(error?.localizedDescription)")       
        } else if let error = error {
            print("Process error \(error.localizedDescription)")
        } else {
            print("Logged in")
        }
    })
}

Info.plist :

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>MY_APP_ID</string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string>MY_APP_ID</string>
<key>FacebookDisplayName</key>
<string>MY_APP_NAME</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsForMedia</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
        <false/>
    </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>
</dict>
@danielghre danielghre added the bug label Jul 1, 2019
@therealchriskondo

This comment has been minimized.

Copy link

commented Jul 2, 2019

I'm experiencing the same thing. Following this workaround works for the moment

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 3, 2019

Hi @therealchriskondo ,
Thanks for the workaround, it works !
I'll wait till' the Facebook Fix comes up

@danielghre danielghre changed the title Login always cancel iOS 13 Xcode 11 Beta 2 Login always cancel iOS 13 Xcode 11 Beta 3 Jul 3, 2019
@therealchriskondo

This comment has been minimized.

Copy link

commented Jul 4, 2019

I stepped through the login flow found the following:

The error being thrown is being thrown by the domain "com.apple.AuthenticationServices.WebAuthenticationSession". This is thrown in the completion block defined in logInWithBehavior function in FBSDKLoginManager.m defined in FBSDKLoginKit.

Continuing on we find the problem is caught in the method _setSessionCompletionHandlerFromHandle from the file FBSDKBridgeAPI.m

[0] (null)  @"NSDebugDescription" : @"Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start."```
@zhiyilee

This comment has been minimized.

Copy link

commented Jul 4, 2019

Same issue.

When I login as a native app, I can not get a successful callback as well as success.

FBSDKCoreKit 5.1.1
FBSDKLoginKit 5.1.1

I also checked for v_5.0.2, but it's same. I never get any callback.
But the v_4.38.0 is always sending cancelled result.

Swift 4.2
xCode 10.2

@danielghre
Do you have any update?
Thanks in advance.

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

Hi @zhiyilee ,
unfortunately no.. Only the workaround works for now

@hansemannn

This comment has been minimized.

Copy link

commented Jul 8, 2019

+1, the Facebook iOS SDK is not iOS 13+ ready so far.

@b-onc

This comment has been minimized.

Copy link

commented Jul 9, 2019

Did you guys try 5.2.1? CHANGELOG says login is fixed but I can't get it to work. It doesn't open Safari when fb app is not present.

@therealchriskondo I've also arrived at the same conclusion after debugging the issue. It was crashing my app on iOS13/SDK4.39.1 but it doesn't seem to crash @5.2.1

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 9, 2019

Same in 5.2.1, login always returns cancel state

@zhiyilee

This comment has been minimized.

Copy link

commented Jul 10, 2019

Finally working for v4.39.1.

Delete Pods folder and Podfile.lock
and pod install

Thanks @danielghre again.

@mtrezza

This comment has been minimized.

Copy link

commented Jul 10, 2019

Does the issue also exist for installing via carthage?

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 15, 2019

Fixed with FBSDKLoginKit & FBSDKCoreKit v5.2.2 !

@danielghre danielghre closed this Jul 15, 2019
@pattessm

This comment has been minimized.

Copy link

commented Jul 26, 2019

This issue seems to have been re-introduced with v5.2.3

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 26, 2019

I have not face the same issue with 5.2.3, did you do the exact same piece of code that I've wrote ?

@pattessm

This comment has been minimized.

Copy link

commented Jul 31, 2019

Yes. It happens on ios 12 simulator now, not 13.

@danielghre

This comment has been minimized.

Copy link
Author

commented Jul 31, 2019

Try to update to the latest version of FBSDKCoreKit and FBSDKLoginKit (5.3.0), It's weird I'm not able to reproduce the bug, everything is working fine here

@vvusts

This comment has been minimized.

Copy link

commented Oct 1, 2019

Built app with xcode 11 and FBSDK 5.6.0 and for native I always get ‘Cancel’ on login try.

@standamikes

This comment has been minimized.

Copy link

commented Oct 2, 2019

XCode 11 and FB SDK 5.6.0 still the same with canceled issue

@xagen12

This comment has been minimized.

Copy link

commented Oct 4, 2019

Before using the above workaround I tried to upgrade on 5.7.0 and to my surprise it worked (XCode 11)

@AnkitSimform

This comment has been minimized.

Copy link

commented Oct 7, 2019

Facing same issue with FBSDK 5.7.0 and Xcode 11.. While trying login using app, callback does not call.

@avinz

This comment has been minimized.

Copy link

commented Oct 10, 2019

Facing same issue with FBSDK 5.7.0 and Xcode 11

@JirsonTavera

This comment has been minimized.

Copy link

commented Oct 10, 2019

Hi, it was how i resolved my issue, pay attention

  1. Update the following dependencies in your Podfile:
Old way New way
pod 'FacebookCore' pod 'FBSDKCoreKit/Swift'
pod 'FacebookLogin' pod 'FBSDKLoginKit/Swift'
pod 'FacebookShare' pod 'FBSDKShareKit/Swift'
  1. Update the import lines in you files:
Old Module Name New Module Name
FacebookCore FBSDKCoreKit
FacebookLogin FBSDKLoginKit
FacebookShare FBSDKShareKit
  1. And now you have to update some parts of your code e.g:

Getting the facebook user data

let connection  = GraphRequestConnection()
connection.add(GraphRequest(graphPath: "/me", parameters: ["fields" : "id,first_name,last_name,email,name"], tokenString: AccessToken.current?.tokenString, version: Settings.defaultGraphAPIVersion, httpMethod: .get)) { (connection, values, error) in
       if let res = values {
            if let response = res as? [String:Any] {
                    let params: [String: Any] = ["email": response["email"]]
            }
       }
}
@RedFish

This comment has been minimized.

Copy link

commented Oct 16, 2019

Version 5.8.0 fix the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.