Skip Navigation

Example of onAuthorized with startServicesWithOptions

The following fragment is extracted from the sample apps
AppNameGDiOSDelegate.m
.
Make sure you add the line highlighted below at the end of your initialization code. Otherwise, your icons might not be displayed properly.

AppNameGDiOSDelegate.m
with
launchPadVC

-(void) onAuthorized:(GDAppEvent*)anEvent { /* Handle the Good Libraries authorized event. */ switch (anEvent.code) { case GDErrorNone: { if (!self.hasAuthorized) { // launch application UI here . . . //Detect the device if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { /* * iPhone start - based on single UINavigationController */ // Setup the rootviewcontroller and a navigation controller (for the splitviewcontroller) self.navController = [[Utilities storyboard] instantiateViewControllerWithIdentifier:@"iPhoneNC"]; GTLauncherViewController *launchPadVC = [[GTLauncherViewController alloc] initWithBaseViewController:self.navController]; appWindow.rootViewController = launchPadVC; [launchPadVC startServicesWithOptions:GTLInternalGDAuthTokenAndPushConnectionManagement]; } else { /* * iPad start - based on UISplitViewController */ self.splitViewController = [[Utilities storyboard] instantiateViewControllerWithIdentifier:@"SplitVC"]; self.navController = [self.splitViewController.viewControllers firstObject]; self.detailNavigationController = [self.splitViewController.viewControllers lastObject]; GTLauncherViewController *launchPadVC = [[GTLauncherViewController alloc] initWithBaseViewController:self.splitViewController]; self.rssReaderAppDelegate.window.rootViewController = launchPadVC; [launchPadVC startServicesWithOptions:GTLInternalGDAuthTokenAndPushConnectionManagement]; . . .

GTLHostGDAuthTokenManagement
startup option

//This method must be implemented if GTLHostGDAuthTokenManagement is a specified startup option - (void)launcherViewController:(GTLauncherViewController *)controller didRequestGDAuthTokenForServerName: (NSString *)name completion: (void (^)(NSString *token))completion { //Implementation specific to the host app [[HostAuthTokenManager tokenManager] getAuthTokenForServer:name completion:^(NSString *token) { if (completion) { completion(token); }; }]; }

GTLHostGDPushConnectionManagement
startup option

//GDPushConnectionDelegate callback - (void)onStatus:(int)status { . . . //The following is required if GTLHostGDPushConnectionManagement is specified as a startup option GTLauncherViewController *launcherVC = ...; [launcherVC setGDPushConnectionStatus:status]; }