14

I have a strange redirect to app issue with our login system in iOS 9 only.

Now, I already have abitrary payload allowed and my url schemes are setup properly in my plist file.

What happens is this:

  • A user is brought to an SFSafariViewController to login with facebook/google
  • The user enters his credentials (or not if they are already cached)
  • Instead of being redirected to our app, the user is then stuck on a blank page if his credentials are cached, or stuck on the final google/facebook login page. No "open in app" dialog appears and the openUrl AppDelegate function is not called.

Now, if the user closes the SFSafariViewController, comes back to our in app login page and attempt to login again a 2nd time, the redirect to the app works every time from there and the openUrl AppDelegate method is called each time.

Do note that on iOS9, we previously redirected outside the app to Safari to complete the login process (instead of using a SFSafariViewController) and had the same issue whereas the "open in App" popup to redirect to the app would only be shown on the 2nd login attempt and up.

This is all happening on iOS 9 only. On iOS 8, this issue does not appear and our users are always redirected to the app after login in.

The redirect url sent to the app after the OAuth login is the same on the first login attempt and up.

Has anyone gotten such a problem on iOS 9?

Bjergsen
  • 207
  • 1
  • 17
  • No, this looks some weird thing, I am developing currently one app.. upgrading to ios 9 firstly it didn't work, then once i added auth in ino.plist, it started to work.. but from your question.. it looks something awkward.. that it is not working first time and then it works.... – Mehul Thakkar Feb 06 '16 at 04:54
  • can you post your code where you are running for authentication from social items – Mehul Thakkar Feb 06 '16 at 04:56
  • its good if you put your login code here. – Code Hunterr Feb 08 '16 at 05:45
  • @tehjord:I have solved same problem..but need your code to confirm the issue. – Rohit Pradhan Feb 08 '16 at 07:44
  • It will be better if you can check and comment the log of the console after first login , it must be logging something.Just run your app in the simulator and paste the log comes in xcode console from "login to whitescreen page".Still I have added an answer , but will be waiting for log. – Vizllx Feb 09 '16 at 20:09
  • I too have the same issue in my application. Not sure what is the reason. – arango_86 Jun 29 '16 at 10:36

2 Answers2

3

As you have mentioned regarding Facebook, so

  1. First, guess you are missing the call of FBSDKApplicationDelegate's application:openURL:sourceApplication:annotation: from UIApplicationDelegate's application:openURL:options:

  2. You may be missing this line NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; in UIApplicationDelegate's didFinishLaunchingWithOptions

  3. Cross check that you have followed the setup as mentioned in this https://developers.facebook.com/docs/ios/ios9

  4. If the device is Jailbreak then in iOS 9.0.2 it will cause the url scheme issue.

Solution that worked for me is the below lines of code, as I have both FB /G+ integrated in my app same as yours:-

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                          openURL:url
                                                sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                       annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]
            || [[GIDSignIn sharedInstance] handleURL:url
                                   sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                          annotation:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{

        return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                          openURL:url
                                                sourceApplication:sourceApplication
                                                       annotation:annotation
                 ] ||
                [[GIDSignIn sharedInstance] handleURL:url
                                          sourceApplication:sourceApplication
                                                 annotation:annotation];
   }
Vizllx
  • 9,135
  • 1
  • 41
  • 79
0

I Had experience with deep linking issues In my case the root of the problem is that we had the CFBundleIdentifier set in the info.plist to a blank String "" by deleting it or setting it to you apps name it fixed our routing issues.

Hope that helps.

Dan Leonard
  • 3,325
  • 1
  • 20
  • 32