Google Sign in CocoaPods Install in Swift?

4.3k Views Asked by At

I am currently working on a Swift-based application that uses a mix of Objective-C and Swift-based Cocoapods.
My Podfile looks something like this:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
use_frameworks!

pod 'SDWebImage', '~> 3.6'
pod 'Alamofire', '~> 1.2'
pod 'Google/SignIn'

My pods worked perfectly up until I added Google Signin.
When I did pod install, I got the following error:

[!] The 'Pods' target has transitive dependencies that include static
binaries: (~/Pods/GoogleAppUtilities/Libraries/libOpenInChrome.a, 
~/Pods/GoogleAuthUtilities/Libraries/libGTMOAuth2_internal.a, 
~/Pods/GoogleAuthUtilities/Libraries/libGTMOAuth2_external.a, 
~/Pods/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_full.a, 
~/Pods/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_core.a, 
~/Pods/GoogleSymbolUtilities/Libraries/libGSDK_Overload.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_iPhone.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_core.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_UIFont+LineHeight.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_SystemVersion.a, 
~/GoogleUtilities/Libraries/libGTM_StringEncoding.a, 
~/GoogleUtilities/Libraries/libGTM_RoundedRectPath.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_Regex.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_NSStringXML.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_NSStringHTML.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_NSScannerJSON.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_NSDictionary+URLArguments.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_KVO.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_GTMURLBuilder.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_DebugUtils.a, 
~/Pods/GoogleUtilities/Libraries/libGTM_AddressBook.a, and 
~/Pods/GoogleUtilities/Libraries/libGTMStackTrace.a)

Also, as soon as I add Google Signin, all the modulemaps and umbrella headers for my other pods disappear, breaking all of them.

This issue from Cocoapods seems to reference this problem as being related to my use of !use_frameworks, but only suggests a workaround (--use-libraries) on the pod publishing end, not from a user standpoint. Is this something I need to wait for Google to fix in their podspec, or is there something I can do on my end to get the Sign-in pod working?

If not, does Google still provide a way to manually install this SDK without Cocoapods?

5

There are 5 best solutions below

1
On BEST ANSWER

I got it working by adding this to my bridging header:

#import <GooglePlus/GooglePlus.h>
#import <GoogleOpenSource/GoogleOpenSource.h>

then swift had access to google sign in :)

1
On

I encountered the same error when running 'pod lib lint' on another project. I fixed it by including the --use-libraries and --allow-warnings command line directives. Perhaps this might help you in resolving your issue.

pod lib lint --use-libraries --allow-warnings
1
On

I was getting the same error not long ago. I just deleted

use_frameworks!

from the podfile and now is working fine.

1
On

try below pod

pod 'GoogleSignIn', '~> 2.2'
0
On

I'm quite late answering this question, but it would appear that the pod install problem was a problem with Cocoapods itself. I updated Cocoapods to its most recent version (now 0.39.0), and I was able to install all the Google pods. I was then able to add lines to my bridging header as niebloomj suggested in this answer and access all of the libraries in Swift.