Thalatta
Thalatta

Reputation: 4578

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:

use_frameworks!

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

I then write import Google at the top of all my .swift 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 use_frameworks!

I have an .xcworkspace 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 Google 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!

Upvotes: 2

Views: 494

Answers (1)

Liam
Liam

Reputation: 12668

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:

Podfile

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

use_frameworks!

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

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.

Usage

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

import GoogleSignIn

Upvotes: 2

Related Questions