###Enabling APIs for Google Services###
-
In your web browser navigate to Google console and sign in with your Google account.
-
Select “Dashboard” and click on the “Create Project” button, creating a new project for your app (following Google’s steps).
-
Once the project is successfully created, click on your project name in the upper bar of the Google console. Select the “Credentials” tab on the left Menu.
-
Click on the “Create Credentials” button, and select “OAuth Client ID” in the sub-menu.
-
Select iOS in the list and complete the required information based on your app. Click “Create” and close the confirmation popup.
-
Return to the Dashboard section and click on “Enable API”.
-
Depending on the services you want to include:
- For Google Drive and/or Google Photos: select “Drive API” under “Google Apps APIs” and click “Enable”.
- For Gmail: select “Gmail API” under “Google Apps APIs” and click “Enable”.
-
Open Google Developers mobile pick iOS platform. Choose App Name and bundle. Choose and Enable Google SignIn. Generate and download configuration file. Add “GoogleService-Info.plist” to app bundle.
-
Add
REVERSED_CLIENT_ID
to URL Scheme base on Google SignIn integration -
Double check
CLIENT_ID
,REVERSED_CLIENT_ID
,URLScheme
equal toOAuth 2.0 client IDs
in google console. Some timesGoogleService-Info.plist
has ID for WEB client. -
Add FSPicker to pod file and install pods
pod "FSPicker", :git => 'https://github.com/swebdevelopment/FSPicker.git', :branch => 'google-services-universal'
-
Add code to AppDelegate:
Objective-C:
#import <FSPicker/FSPicker.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[FSGoogleServicesManager shared] application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary *)options {
return [[FSGoogleServicesManager shared] application:app openURL:url options:options];
}
SWIFT:
import FSPicker
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FSGoogleServicesManager.shared().application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return FSGoogleServicesManager.shared().application(app, open: url, options: options)
}