Twitter app not redirecting back to my app after successful login

login
ios

#1

Using Cocoapods TwitterKit 3.2.1
iPhone 6, iOS 10 and 11,

I was able to share to Twitter app just fine if the user is already logged in for Twitter app. But if I try to share while logged out, the Twitter app asks for login. After successful log in, there is no redirecting back to my app. Why is there no redirecting after successful log in? It seems to work if using the WebView login.

[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession * _Nullable session, NSError * _Nullable error) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    __strong typeof(weakSelf) strongSelf = weakSelf;
                    if (session != nil) {
                        TWTRComposerViewController *composer =
                        [[TWTRComposerViewController alloc]
                         initWithInitialText:message
                         image:nil
                         videoURL:strongSelf.videoUrl];
                        composer.delegate = self;
                        [strongSelf presentViewController:composer animated:YES completion:nil];
                    } else if (error) {
                        [strongSelf.progressView setHidden:YES];
                        if (error.code != TWTRLogInErrorCodeCancelled) {
                            //handle error
                        }
                    }
                });
            }];

#2

Just wanted to check you’ve implemented all of these steps in your app?

Before using Twitter Kit for log in, developers implement the following:

  1. Add a Twitter Kit (twitterkit-<consumer key>) URL scheme to your app. See URL Scheme Setup section of Installation document.
  2. Implement the application:openURL:options method in your Application Delegate, and pass along the redirect URL to Twitter Kit. See URL Redirect
  3. Add SafariServices.framework to use SFSafariViewController.

#3

@GoatMadder This is a known issue and we are working to get this fixed! you can read more about it here