I am trying to integrate the GoogleSign-In for iOS with the documentation found here: https://developers.google.com/identity/sign-in/ios/start-integrating
Ho
After a week of grappling with this beast, I want to update this answer for version Google Sign-In SDK 4.0.0. The instructions at
https://developers.google.com/identity/sign-in/ios/sdk/
appear to be wrong for version 4.0.0. They say you only need to link
GoogleSignIn.frameworkGoogleSignIn.bundle(along with AddressBook.framework, StoreKit.framework, and SystemConfiguration.framework of course). However, you will get lots of mystifying
Undefined symbols for architecture x86_64
errors if that's all you include. The CHANGELOG.md file gets you closer to the truth with this statement:
For users of the stand-alone zip distribution, multiple frameworks are now provided and all need to be added to a project. This decomposition allows more flexibility in case of duplicated dependencies.
So in reality you also need to include:
GoogleAppUtilities.frameworkGoogleAuthUtilities.frameworkGoogleNetworkingUtilities.frameworkGoogleSymbolUtilities.frameworkGoogleUtilities.frameworkSo now you should be golden, right? As all good informercials say...
But wait, there's more!
You also need to include
libz.tbdThis answer gave the clue to including that library too. Without that, you will get the error
unrecognized selector sent to instance
but only on this line of code
GIDSignIn.sharedInstance().clientID = "MyClientID"
If you remark out that line, the code will work fine, even with this code still there
GIDSignIn.sharedInstance().delegate = self
To me this was the most misleading part. Most of the answers on the web for that error will say you need to set the OtherLinkerFlag to -ObjC, and I'm sure that's a common cause of problems if it's not set correctly or at all, but in my case it was clearly set right, plus the setting of the delegate worked, which meant that other properties of GIDSignIn could be set, so why not the clientID? I thought perhaps my clientID was wrong somehow and I wasted a lot of time chasing that false clue.
All of this headache can be avoided by just using the CocoaPod, but in my case I really wanted to make it work without adding the complexity that CocoaPods bring, because I'm also including Facebook's SDK.
P.S. I found this tutorial
http://www.appcoda.com/google-sign-in-how-to/
to be much better written than Google's tutorial, especially the reminder that you need to use a UIView and not a UIButton for the Google sign-in button. I spent some time confused about why I couldn't set the button's class to GIDSignInButton until I came across this tutorial. Just keep in mind that you'll need to link the libraries the way I described above rather than the way the tutorial says because it's different now.
Also make sure you link the dependent frameworks.
AddressBook.frameworkStoreKit.frameworkSystemConfiguration.frameworkSee related Upgrading from Google Sign-In SDK 1.0.0 to 2.0.1 fails to compile on SKStore references.
The standalone SDK is available here now: https://developers.google.com/identity/sign-in/ios/sdk/
As mentioned by other posters, you must add the following dependent frameworks:
AddressBook.frameworkStoreKit.frameworkSystemConfiguration.frameworkYou may also need to set Other Linker Flags: -ObjC flag in your project's build steps.