Thalatta Thalatta - 1 year ago 87
iOS Question

Cocoapods: not loading Google SDK on xcodebuild

I am using the Google SDK for SignIn in my ios 9 app. It successfully works and runs locally on my phone. and through clicking "Run" in xCode with my phone as the target.

Here is my PodFile:


target "myApp" do
pod 'Google/SignIn'
pod 'Firebase'

I then write
import Google
at the top of all my
files which use any delegate methods for SignIn or any other things related to authenticating with the Google SDK.

I don't use a bridging header because of

I have an
that I am trying to make a executable of through a gitlab runner.

When I run the following in my runner

xcodebuild test -workspace myApp.xcworkspace -scheme myApp -destination 'platform=iOS Simulator,name=iPhone 6s,OS=9.3' | xcpretty -s

I get the following error:

AppDelegate.swift:17:56: use of undeclared type 'GIDSignInDelegate'

and basically every single usage of a
dependent function or variable name throws in error.

It could be because it is
xcodebuild test
and somehow I am not properly linking my pods correctly for the test case of a build? Any help appreciated!

Answer Source

If you want to use the Google Sign In SDK on it's own without any other google services then I would recommend the following approach:


In your Podfile, declare the Sign In library directly like so


target "myApp" do
    pod 'GoogleSignIn', '4.0.0'

Note: I'm specifying an explicit version number here because as of Cocoapods 1.0, the pod spec repo is no longer updated on every pod install call.

Module support wasn't introduced in the Google Sign In SDK until the latest version (4.0.0) on 18th May 2016 so if you haven't run pod repo update since then from the code example in your question you would actually be installing an older version of the SDK that doesn't support what you are trying to do.

If you receive an error when trying to run pod install with the above Podfile then running pod repo update should fix your issues.


In your .swift files where you use the SDK, import the library like so:

import GoogleSignIn