Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UnityAppController + Vuforia

Discussion in 'iOS and tvOS' started by Studio-Raef, Sep 1, 2016.

  1. Studio-Raef

    Studio-Raef

    Joined:
    Jul 1, 2013
    Posts:
    9
    I wrote code to add google sign in to Unity on iOS

    it works with a subclass of the unityappcontroller where GIDSignin gets a UIDelegate from the applicationDidFinishWithOptions

    The h file
    Code (CSharp):
    1. #import "UnityAppController.h"
    2. #import <GoogleSignIn/GoogleSignIn.h>
    3. @interface GoogleAuthUnity: UnityAppController{
    4.    
    5. }
    6. @end
    7. IMPL_APP_CONTROLLER_SUBCLASS(GoogleAuthUnity)
    The mm
    Code (CSharp):
    1.  
    2. @interface GoogleAuthUnity() <GIDSignInUIDelegate>
    3.  
    4. @end
    5.  
    6. @implementation GoogleAuthUnity
    7. - (BOOL)application:(UIApplication *)application
    8.             openURL:(NSURL *)url
    9.   sourceApplication:(NSString *)sourceApplication
    10.          annotation:(id)annotation {
    11.     [super application:application
    12.                openURL:url
    13.      sourceApplication:sourceApplication
    14.             annotation:annotation];
    15.     return [[GIDSignIn sharedInstance] handleURL:url
    16.                                sourceApplication:sourceApplication
    17.                                       annotation:annotation];
    18. }
    19. - (BOOL)application:(UIApplication *)application
    20. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    21.     [super application:application didFinishLaunchingWithOptions:launchOptions];
    22.    
    23.     GIDSignIn* signIn = [GIDSignIn sharedInstance];
    24.     signIn.scopes = @[ @"profile", @"email" ];
    25.     signIn.uiDelegate = self;
    26.     printf_console("-> googleDelegateSet\n");
    27.     return YES;
    28. }
    29.  
    Now this and the subsequent code works in an empty project, but after porting it to a project with Vuforia, the applicationdidFinishLaunchingWithOptions doesn't get called.

    One of the vuforia classes (VuforiaNativeRendererController) is a subclass of the UnityAppController and when I add the applicationDidFinishLaunchingWithOptions does get called in that class.

    But I wonder if there's a way to get my other class working and set that uiDelegate of the Google Sign In

    I'm not wellversed in coding plugins for iOS and I was happy to see it working on its own, but I just can't get it to work with Vuforia.

    Does anyone have an idea?