Completed sign-in but not being redirected to my app

ios
fabric

#1

as the title describes, it stuck on that state.
i didnt find a solution searching the net.
no error exist…

image (Hebrew) attached:
it basically says : “redirecting you back to the app, it might take a few moments…”

Code:
AppDelegate -

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    
    var configureError: NSError?
    GGLContext.sharedInstance().configureWithError(&configureError)
    assert(configureError == nil, "Error configuring Google services: \(configureError)")
    
    Fabric.with([Twitter.self])

    return true
}


//deprecaed - for support
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    let directedByFB = FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
    let directedByGoogle = GIDSignIn.sharedInstance().handle(url as URL!, sourceApplication: sourceApplication,annotation: annotation)
    return directedByFB || directedByGoogle
}


func application(application:UIApplication, openURL url: URL, options: [String: AnyObject]) -> Bool {
    if Twitter.sharedInstance().application(application, open: url, options: options) {
        return true
    }
    return GIDSignIn.sharedInstance().handle(url as URL!, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication.rawValue] as? String, annotation: options[UIApplicationOpenURLOptionsKey.annotation.rawValue])
}

SocialChooserViewController -
TWTRAPIClient completion callback is nit being called… (its not redirecting back to my app)

@IBAction func continueLoginWithTwitter() {
    Twitter.sharedInstance().logIn(withMethods: [.webBased]) { session, error in
        guard session != nil else {
            print("error connecting with Twitter: \(error?.localizedDescription)");
            return
        }
        self.chosenMedia = .twtr
        let client = TWTRAPIClient(userID: session!.userID)
        client.loadUser(withID: session!.userID) { (unwrappedTwtrUser, error) in
            guard let twtrUser = unwrappedTwtrUser, error == nil else {
                print("Twitter : TwTRUser is nil, or error has occured: ")
                print("Twitter error: \(error!.localizedDescription)")
                return
            }
            _ = self.user.set(firstAndFamilyName: twtrUser.name)
            self.user.set(imageURL: twtrUser.profileImageMiniURL)
            self.user.set(token: session!.authToken)
            self.performSegue(withIdentifier: "toProfileVC", sender: self)
        }
    }
}

Secondary:
as further to what i have asked i would also want to change the name of the app bieng presented on permission page, how to do it?


#2

Hey @itayc14, hmm I haven’t seen this happen before. Does it happen on all devices and with all Twitter accounts trying to sign-in?


#3

yes it also happens in both iphone7 and 5 (simulator, i dont own yet a real device… )


#4

ANSWER:
there is more updated method at the delegate,
twitter was calling the deprecated method (as you can see above) but i didnt actually handled twitter inside - so no everything is under the updated method and works just fine and organized:

func application(_ application:UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool {
    print("called")
    let directedByFB = FBSDKApplicationDelegate.sharedInstance().application(application, open: url, options: options)
    let directedByTWTR =  Twitter.sharedInstance().application(application, open: url, options: options)
    let directedByGGL =  GIDSignIn.sharedInstance().handle(url as URL!, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplicationOpenURLOptionsKey.annotation])
    return directedByGGL || directedByTWTR || directedByFB
}

#5

@itayc14, great to hear it’s working! In terms of modifying the Twitter app name, if you head to the Twitter dashboard on fabric.io, you can edit the app name.