Google Sign-in for iOS

1.Download GoogleSignIn SDK
https://developers.google.com/identity/sign-in/ios/sdk/
There are two ways to get the SDK, CocoaPod or direct download,
Personally I preferred the download way.
0.Download SDK
Follow the official document procedure
https://developers.google.com/identity/sign-in/ios/start

2.Get configuration file
https://developers.google.com/mobile/add?platform=ios&cntapi=signin&cntapp=Default%20Demo%20App&cntpkg=com.google.samples.quickstart.SignInExample&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fios%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue%20with%20Try%20Sign-In

2.EnableSignin

 

3.Copy to project directory first then “pull” into xcode project
Basically just pull the configuration file into the xcode project  and it is OK.
But you will gonna thank me for this lousy procedure when there are multiple configuration files in one xcode project.
3.Download plist
4.Configure xcode project-level parameters
https://developers.google.com/identity/sign-in/ios/sign-in?configured=true

Put REVERSED_CLIENT_ID into Project -> Target -> Info -> URL Types
Put bundle id into Project -> Target -> Info -> URL Types

4.URLTypes

 

5.Modify source code
There will be only one file to be modified – AppDelegate

The most important statement is to set [GIDSignIn sharedInstance].clientID = CLIENT_ID(in configuration)

 

 

 

 

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *