{"action":"created","issue":{"url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/508","repository_url":"https://api.github.com/repos/react-native-community/react-native-google-signin","labels_url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/508/labels{/name}","comments_url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/508/comments","events_url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/508/events","html_url":"https://github.com/react-native-community/react-native-google-signin/issues/508","id":357777127,"node_id":"MDU6SXNzdWUzNTc3NzcxMjc=","number":508,"title":"Click on SignIn breaks app with error: uiDelegate must either be a |UIViewController| or...","user":{"login":"dkfl1995","id":22290787,"node_id":"MDQ6VXNlcjIyMjkwNzg3","avatar_url":"https://avatars3.githubusercontent.com/u/22290787?v=4","gravatar_id":"","url":"https://api.github.com/users/dkfl1995","html_url":"https://github.com/dkfl1995","followers_url":"https://api.github.com/users/dkfl1995/followers","following_url":"https://api.github.com/users/dkfl1995/following{/other_user}","gists_url":"https://api.github.com/users/dkfl1995/gists{/gist_id}","starred_url":"https://api.github.com/users/dkfl1995/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkfl1995/subscriptions","organizations_url":"https://api.github.com/users/dkfl1995/orgs","repos_url":"https://api.github.com/users/dkfl1995/repos","events_url":"https://api.github.com/users/dkfl1995/events{/privacy}","received_events_url":"https://api.github.com/users/dkfl1995/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-06T18:39:54Z","updated_at":"2018-09-06T18:56:15Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nPlease make sure you have searched previous issues before opening a new issue.\r\n-->\r\n\r\nHi, guys! I faced with unknown for me before issue after upgrade RN 0.44 => 0.56 and taken the lastest react-native-google-signin 1.0.0-rc03.\r\n**My Google SignIn button is NOT from this package ** e.g. is **Custom**.\r\nI will provide the code of google signin btn and method below.\r\nWhen I press on this btn app crashes with error below.\r\n\r\n<!-- Describe your issue in detail. -->\r\n```\r\nException 'uiDelegate must either be a |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| methods from |GIDSignInUIDelegate|.' was thrown while invoking signIn on target RNGoogleSignin with params (\r\n    2812,\r\n    2813\r\n)\r\ncallstack: (\r\n\t0   CoreFoundation                      0x000000010930a12b __exceptionPreprocess + 171\r\n\t1   libobjc.A.dylib                     0x00000001077c3f41 objc_exception_throw + 48\r\n\t2   CoreFoundation                      0x000000010937f245 +[NSException raise:format:] + 197\r\n\t3   Foodilog                            0x000000010150d2a4 -[RCTVibration vibrate] + 29412\r\n\t4   Foodilog                            0x0000000101509e9a -[RCTVibration vibrate] + 16090\r\n\t5   Foodilog                            0x0000000101553771 -[RNGoogleSignin signInResolve:signInReject:] + 241\r\n\t6   CoreFoundation                      0x000000010928e36c __invoking___ + 140\r\n\t7   CoreFoundation                      0x000000010928e240 -[NSInvocation invoke] + 320\r\n\t8   CoreFoundation                      0x00000001092a6c26 -[NSInvocation invokeWithTarget:] + 54\r\n\t9   Foodilog                            0x0000000100e3392c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796\r\n\t10  Foodilog                            0x0000000100ee9942 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786\r\n\t11  Foodilog                            0x0000000100ee946f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127\r\n\t12  Foodilog                            0x0000000100ee93e9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25\r\n\t13  libdispatch.dylib                   0x000000010a4ec2f7 _dispatch_call_block_and_release + 12\r\n\t14  libdispatch.dylib                   0x000000010a4ed33d _dispatch_client_callout + 8\r\n\t15  libdispatch.dylib                   0x000000010a4f85f9 _dispatch_main_queue_callback_4CF + 628\r\n\t16  CoreFoundation                      0x00000001092cce39 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\r\n\t17  CoreFoundation                      0x0000000109291462 __CFRunLoopRun + 2402\r\n\t18  CoreFoundation                      0x0000000109290889 CFRunLoopRunSpecific + 409\r\n\t19  GraphicsServices                    0x000000010d63a9c6 GSEventRunModal + 62\r\n\t20  UIKit                               0x0000000104dd75d6 UIApplicationMain + 159\r\n\t21  Foodilog                            0x0000000100cf20bf main + 111\r\n\t22  libdyld.dylib                       0x000000010a569d81 start + 1\r\n)\r\nreactConsoleErrorHandler @ ae04b08f-4669-40e4-a…-1cba219fbe13:27343\r\nconsole.error @ ae04b08f-4669-40e4-a…-1cba219fbe13:56405\r\nlogToConsole @ ae04b08f-4669-40e4-a…-1cba219fbe13:31397\r\nlogIfNoNativeHook @ ae04b08f-4669-40e4-a…-1cba219fbe13:31380\r\n__callFunction @ ae04b08f-4669-40e4-a…6-1cba219fbe13:4344\r\n(anonymous) @ ae04b08f-4669-40e4-a…6-1cba219fbe13:4121\r\n__guard @ ae04b08f-4669-40e4-a…6-1cba219fbe13:4297\r\ncallFunctionReturnFlushedQueue @ ae04b08f-4669-40e4-a…6-1cba219fbe13:4120\r\n(anonymous) @ debuggerWorker.js:72\r\n\r\n```\r\n\r\n## Steps to Reproduce\r\n\r\n1.have RN project with specified JS code (code for btn and google methods besides of other RN stuff providing here):\r\n\r\n```\r\nasync _setupGoogleSignin() {\r\n        try {\r\n            await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });\r\n\r\n            const configPlatform = {\r\n                ...Platform.select({\r\n                    ios: {\r\n                        iosClientId: API.GOOGLE_IOS_CLIENTID,\r\n                    },\r\n                    android: {},\r\n                }),\r\n            };\r\n\r\n            await GoogleSignin.configure({\r\n                ...configPlatform,\r\n                scopes: [\r\n                    \"profile\"\r\n                ]\r\n            });\r\n\r\n            const user = await GoogleSignin.signInSilently();\r\n            console.log(user);\r\n        }\r\n        catch (err) {\r\n            console.log(\"Play services error\", err.code, err.message);\r\n        }\r\n    }\r\n\r\n    _googleSignIn() {\r\n        if (this.state.agree) {\r\n        const { dispatchLogin, } = this.props\r\n        GoogleSignin.signIn()\r\n            .then((res) => {\r\n                this._user = {...res};\r\n                if(user.accessToken && Platform.OS === \"android\"){\r\n                    let token = user.accessToken\r\n                    // RNGoogleSignin.getAccessToken(user).then(token => {\r\n                        console.log(\"android token: \",token)\r\n                        // this._user.accessToken = token;\r\n                        AsyncStorage.setItem(\"FoodilogGoogleToken\", token)\r\n                        AsyncStorage.setItem('CurrentSocialLogin', 'google');\r\n                        this.setState({ isLoading: false })\r\n                        this.dispatchLogin(API.GOOGLE_LOGIN_URL, token, '');\r\n                    // })\r\n                    this.setState({ isLoading: false })\r\n                }\r\n                if (user.accessToken && Platform.OS === \"ios\") {\r\n                    this.setState({ isLoading: false })\r\n                    AsyncStorage.setItem(\"FoodilogGoogleToken\", token)\r\n                    AsyncStorage.setItem('CurrentSocialLogin', 'google');\r\n                    this.dispatchLogin(API.GOOGLE_LOGIN_URL, this._user.accessToken, '');\r\n                }\r\n            })\r\n            .catch((err) => {\r\n                alert(\"Google SignIn Error: \" + err);\r\n                console.log('WRONG SIGNIN', err);\r\n            })\r\n            .done();\r\n        } else {\r\n        alert('Please Agree to our User Agreement');\r\n        }\r\n    }\r\n```\r\n\r\nThe AppDelegate.h file containment:\r\n\r\n```\r\n#import <UIKit/UIKit.h>\r\n@import GoogleSignIn;\r\n\r\n@interface AppDelegate : UIResponder <UIApplicationDelegate, GIDSignInDelegate>\r\n\r\n@property (nonatomic, strong) UIWindow *window;\r\n\r\n@end\r\n```\r\n\r\nThe AppDelegate.m file containment: \r\n\r\n```\r\n#import \"AppDelegate.h\"\r\n\r\n#import <React/RCTBundleURLProvider.h>\r\n#import <React/RCTRootView.h>\r\n\r\n#import \"RNSplashScreen.h\"\r\n\r\n#import \"OAuthManager.h\"\r\n\r\n#import <FBSDKCoreKit/FBSDKCoreKit.h>\r\n\r\n@implementation AppDelegate\r\n\r\n- (void)applicationDidBecomeActive:(UIApplication *)application {\r\n  [FBSDKAppEvents activateApp];\r\n}\r\n\r\n- (BOOL)application:(UIApplication *)application\r\ndidFinishLaunchingWithOptions:(NSDictionary *)launchOptions\r\n{\r\n  NSURL *jsCodeLocation;\r\n\r\n  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index.ios\" fallbackResource:nil];\r\n\r\n  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation\r\n                                                      moduleName:@\"Foodilog\"\r\n                                               initialProperties:nil\r\n                                                   launchOptions:launchOptions];\r\n  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];\r\n  \r\n  [GIDSignIn sharedInstance].clientID = @\"522557398228-tq8rkul6rq4dtlqbk0cq10h5esadkms0.apps.googleusercontent.com\";\r\n  [GIDSignIn sharedInstance].Delegate = self;\r\n  \r\n  \r\n  [[FBSDKApplicationDelegate sharedInstance] application:application\r\n                           didFinishLaunchingWithOptions:launchOptions];\r\n  \r\n  [OAuthManager setupOAuthHandler:application];\r\n\r\n  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];\r\n  UIViewController *rootViewController = [UIViewController new];\r\n  rootViewController.view = rootView;\r\n  self.window.rootViewController = rootViewController;\r\n  [self.window makeKeyAndVisible];\r\n  [RNSplashScreen show];\r\n  [NSThread sleepForTimeInterval:1.0];\r\n  return YES;\r\n}\r\n\r\n- (void)signIn:(GIDSignIn *)signIn\r\npresentViewController:(UIViewController *)viewController\r\n     withError:(NSError *)error{\r\n}\r\n\r\n- (void)signIn:(GIDSignIn *)signIn\r\ndismissViewController:(UIViewController *)viewController\r\n     withError:(NSError *)error{\r\n}\r\n\r\n- (void)signIn:(GIDSignIn *)signIn\r\ndidSignInForUser:(GIDGoogleUser *)user\r\n     withError:(NSError *)error {\r\n  // Perform any operations on signed in user here.\r\n  NSString *userId = user.userID;                  // For client-side use only!\r\n  NSString *idToken = user.authentication.idToken; // Safe to send to the server\r\n  NSString *fullName = user.profile.name;\r\n  NSString *givenName = user.profile.givenName;\r\n  NSString *familyName = user.profile.familyName;\r\n  NSString *email = user.profile.email;\r\n  // ...\r\n}\r\n\r\n- (void)signIn:(GIDSignIn *)signIn\r\ndidDisconnectWithUser:(GIDGoogleUser *)user\r\n     withError:(NSError *)error {\r\n  // Perform any operations when the user disconnects from app here.\r\n  // ...\r\n}\r\n\r\n\r\n\r\n- (BOOL)application:(UIApplication *)application\r\n            openURL:(NSURL *)url\r\n  sourceApplication:(NSString *)sourceApplication\r\n         annotation:(id)annotation {\r\n  return [OAuthManager handleOpenUrl:application\r\n                  openURL:url\r\n                  sourceApplication:sourceApplication\r\n                  annotation:annotation] ||\r\n  [[GIDSignIn sharedInstance] handleURL:url\r\n                  sourceApplication:sourceApplication\r\n                  annotation:annotation] ||\r\n  [[FBSDKApplicationDelegate sharedInstance] application:application\r\n                  openURL:url\r\n                  sourceApplication:sourceApplication\r\n                  annotation:annotation];\r\n}\r\n\r\n// Solve the conflict between react-native-oauth and react-native-fbsdk to redirect oauth authentication properly\r\n//Below is an example how to resolve that for IOS higher 8 versions - add OAuthManager class instance with following properties\r\n\r\n//- (BOOL)application:(UIApplication *)application\r\n//            openURL:(NSURL *)url\r\n//            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {\r\n//  if ([url.absoluteString containsString:@\"twitter\"]){\r\n//    return [OAuthManager handleOpenUrl:application\r\n//                               openURL:url\r\n//                     sourceApplication:@\"twitter\"\r\n//                            annotation:nil];\r\n//  } else{\r\n//    BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application\r\n//                                                                  openURL:url\r\n//                                                        sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]\r\n//                                                               annotation:options[UIApplicationOpenURLOptionsAnnotationKey]\r\n//                    ];\r\n//    return handled;\r\n//  }\r\n//}\r\n\r\n//...\r\n\r\n\r\n- (BOOL)application:(UIApplication *)application\r\n            openURL:(NSURL *)url\r\n            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {\r\n\r\n  BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application\r\n                    openURL:url\r\n          sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]\r\n                 annotation:options[UIApplicationOpenURLOptionsAnnotationKey]\r\n                  ] ||\r\n  [[GIDSignIn sharedInstance] handleURL:url\r\n                      sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]\r\n                             annotation:options[UIApplicationOpenURLOptionsAnnotationKey]] ||\r\n  [OAuthManager handleOpenUrl:application\r\n                      openURL:url\r\n            sourceApplication:@\"twitter\"\r\n                   annotation:nil];\r\n\r\n  // Add any custom logic here.\r\n  return handled;\r\n}\r\n\r\n@end\r\n```\r\n\r\nCode compiles well and build succeeds.\r\n\r\nGoogleSignIn.framework imported to linked binaries as well.\r\n\r\n- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.\r\n\r\nBuild an app inside XCode and run with simulator at IOS version 11.2\r\n\r\n## Expected Behavior\r\n\r\nStarted Google SignIn view. \r\n<!-- Write what you thought would happen. -->\r\n\r\n## Actual Behavior\r\n\r\nError crashes app\r\n<!-- Write what happened. Include screenshots if needed. If this is a regression, let us know. -->\r\n\r\n## Environment\r\n\r\nPlease provide the version of your\r\n\r\n- react-native: 0.56\r\n- react-native-google-signin: 1.0.0-rc03\r\n- react: 16.4.2\r\n- cocoapods and GoogleSignIn pod version (if applicable): install manually\r\n- gradle, android plugin for gradle and play-services-auth version (if applicable): no matter\r\n"},"comment":{"url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/comments/419204484","html_url":"https://github.com/react-native-community/react-native-google-signin/issues/508#issuecomment-419204484","issue_url":"https://api.github.com/repos/react-native-community/react-native-google-signin/issues/508","id":419204484,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTIwNDQ4NA==","user":{"login":"jozan","id":388265,"node_id":"MDQ6VXNlcjM4ODI2NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/388265?v=4","gravatar_id":"","url":"https://api.github.com/users/jozan","html_url":"https://github.com/jozan","followers_url":"https://api.github.com/users/jozan/followers","following_url":"https://api.github.com/users/jozan/following{/other_user}","gists_url":"https://api.github.com/users/jozan/gists{/gist_id}","starred_url":"https://api.github.com/users/jozan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jozan/subscriptions","organizations_url":"https://api.github.com/users/jozan/orgs","repos_url":"https://api.github.com/users/jozan/repos","events_url":"https://api.github.com/users/jozan/events{/privacy}","received_events_url":"https://api.github.com/users/jozan/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T18:56:15Z","updated_at":"2018-09-06T18:56:15Z","author_association":"COLLABORATOR","body":"Check how our [example app](https://github.com/react-native-community/react-native-google-signin/blob/master/example/ios/GoogleSigninSampleApp/AppDelegate.m) has been set up. This is our official and only way how to use this library which is supported. Compare your `AppDelegate.h` and `AppDelegate.m` to our example app and you'll know how to setup our library.\r\n\r\n`(BOOL)application:openURL:options:` probably doesn't work out of the box but for that check out the last code example in our [iOS documentation](https://github.com/react-native-community/react-native-google-signin/blob/master/ios-guide.md#modify-your-app-to-respond-to-the-url-scheme)."}}
{"actor":{"display_login":"jozan"}}