Google-signin: Library build issues on iOS with clean install

Created on 15 Aug 2018  ·  21Comments  ·  Source: react-native-google-signin/google-signin

I cannot get the library to build for iOS

Steps to Reproduce

$ react-native init testApp
$ cd testApp
$ cd ios
$ pod init
$ cd ..
$ yarn add react-native-google-signin
$ react-native link react-native-google-signin
$ cd ios
$ # Edit podfile and add "pod 'GoogleSignIn'"
$ pod install
$ cd ..
$ react-native run-ios

Expected Behavior

The library would build and allow me to run the app

Actual Behavior

▸ Compiling RNGoogleSignin.m

❌  /Users/elliott/PatronGG/testProject/node_modules/react-native-google-signin/ios/RNGoogleSignin/RNGoogleSignin.h:4:9: 'React/RCTBridgeModule.h' file not found

#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~


▸ Compiling RNGoogleSignInButton.m

❌  /Users/elliott/PatronGG/testProject/node_modules/react-native-google-signin/ios/RNGoogleSignin/RNGoogleSignInButton.m:1:9: 'React/RCTLog.h' file not found

#import <React/RCTLog.h>
        ^~~~~~~~~~~~~~~~


▸ Compiling RNGoogleSignin-dummy.m
▸ Compiling PromiseWrapper.m

❌  /Users/elliott/PatronGG/testProject/node_modules/react-native-google-signin/ios/RNGoogleSignin/PromiseWrapper.h:11:9: 'React/RCTBridgeModule.h' file not found

#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~


▸ Compiling RNGoogleSigninButtonManager.m

❌  /Users/elliott/PatronGG/testProject/node_modules/react-native-google-signin/ios/RNGoogleSignin/RNGoogleSigninButtonManager.m:1:9: 'React/RCTViewManager.h' file not found

#import <React/RCTViewManager.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~


** BUILD FAILED **

Also, in the packager

Loading dependency graph, done.
jest-haste-map: @providesModule naming collision:
  Duplicate module name: react-native
  Paths: /Users/elliott/PatronGG/testProject/ios/Pods/React/package.json collides with /Users/elliott/PatronGG/testProject/node_modules/react-native/package.json

Environment

Please provide the version of your

  • react-native @ 0.56.0
  • react-native-google-signin @ 1.0.0-rc3
  • react @ 16.4.1
  • cocoapods and GoogleSignIn pod version (if applicable)
    cocoapods (1.5.3) GoogleSignIn (4.1.2)

My thoughts

After digging around for a bit, I think I found a few core issues.

  1. React-Native-Google-Signin depends on the React pod, which is deprecated. This causes name conflicts (hence why the packager things React-Native was defined twice) because everything that was in the React pod is now included by default, without need for the pod.
  2. All of the #import <React/___.h> need to be changed to #import "___.h" (see above) because the React Pod is deprecated and needs to go
  3. self.promiseReject(errorCode, errorMessage, error); needs to be renamed or changed because promiseReject already exists and it only has 1 argument (this is already being tracked at (https://github.com/react-native-community/react-native-google-signin/issues/480) )

Most helpful comment

Update: I have been able to build the library for iOS now.

  1. react-native unlink react-native-google-signin
  2. Remove GoogleSignIn and RNGoogleSignin pods from podfile
  3. Follow manual linking instructions but stop before Step 3
  4. Add $(SRCROOT)/../node_modules/react-native-google-signin/ios/RNGoogleSignin to the Header Search Paths in Build Settings
  5. Continue with setup instructions here

This is still not optimal, as the podspec still needs updating and the projects automatic linking should handle this for developers. If I have some time in coming days, I'll take a look at it if possible

All 21 comments

You probably didn't want to install through cocoapods, please remove the react-native-google-signin podspec definition from your podfile and follow manual installation instructions.

@vonovak The RNGoogleSignin pod dependency is added by react-native link react-native-google-signin, so I think it is supposed to be there. Even when removed, the first step of the manual instructions says "add ios/RNGoogleSignin.xcodeproj to your xcode project", but this does not compile, because the "React" project does not exist (meaning that the #import <React/__.h> directives will fail). If you include React in your podfile, it causes name conflicts.

The core issue is that react-native-google-signin needs to be updated. Remove deprecated dependencies, update remaining dependencies, and fix the iOS api to have no name conflicts.

Update: I have been able to build the library for iOS now.

  1. react-native unlink react-native-google-signin
  2. Remove GoogleSignIn and RNGoogleSignin pods from podfile
  3. Follow manual linking instructions but stop before Step 3
  4. Add $(SRCROOT)/../node_modules/react-native-google-signin/ios/RNGoogleSignin to the Header Search Paths in Build Settings
  5. Continue with setup instructions here

This is still not optimal, as the podspec still needs updating and the projects automatic linking should handle this for developers. If I have some time in coming days, I'll take a look at it if possible

@ellman121 you said in step 5 to keep the instructions but don't say where we should continue, can you be more clear ? Thank you

@mendesfelipe87 Continue at step 3

@ellman121 Thank you

@ellman121 I followed your fix instructions and was able to build everything but when I try to import anything with
import { GoogleSignin, GoogleSigninButton } from 'react-native-google-signin';
it throws the following error
undefined is not an object (evaluating 'RNGoogleSignin.SIGN_IN_CANCELLED')
Did you get this error too? Were you able to fix it?

@ellman121

The RNGoogleSignin pod dependency is added by react-native link react-native-google-signin, so I think it is supposed to be there

That depends, but it is likely that it is not supposed to be there. If your podfile looks like this then yes, otherwise not and you should follow manual installation instructions or remove the podspec file before you run react-native link react-native-google-signin

I can not find the AddressBook.framework, SafariServices.framework, SystemConfiguration.framework.
Only using react-native link react-native-google-signin, and pod 'GoogleSignIn' i can run my project.
But when i using signIn(), only error page 500 show up. I research but no luck :(
Any help please?

@ellman121 where can i find AddressBook.framework, SafariServices.framework, SystemConfiguration.framework ? I download google_signin_sdk_4_2_0 but can not find the files.

@ducpt2 AddressBook.framework, SafariServices.framework, SystemConfiguration.framework come with Xcode and are provided by Apple.

Error 500 is likely a misconfiguration but I've not seen it before so I cannot be sure.

@jozan i try following @ellman121 step, but still error. Can you guild me the step with new version of react-native-google-sigin 1.0.0-rc3?
Thank you.

@jozan Thank you, it work for both Android and iOS now :)

@ducpt2 can u please detail what u have done ? i am facing the same problem, thanks

@endysar Is your error on iOS?

@ducpt2, yes on ios only, android work perfectly

@endysar my issue is i create too many OAuth2 key? I only keep the auto key firebase create, and it work.

@ducpt2 , thanks for the info, i only have one OAuth2 key though but still facing error 500 issue

Sorry, i forgot to mention, go to Safari and delete the history of browser. :)
Hope it help.

I had the same issue recently (I'm also adding the lib with CocoaPods), but I realised that somehow a new entry appeared in my .pbxproj file that caused this. I removed it and everything got back to normal.

LIBRARY_SEARCH_PATHS = (
    "$(inherited)",
    "\"$(SRCROOT)/$(TARGET_NAME)\"",
);

We rewrote the ios guide for the latest RC, so this should no longer be an issue. Please see the NOTE in here

Was this page helpful?
0 / 5 - 0 ratings