When trying to fetch Google Calendars in iOS, console shows weird api#channel conflicts. How to solve? -
i trying build app fetch google calendar information such calendars, events etc running big problem.
this code:
#define googleclientid @"client id" #define googleclientsecret @"secret" #define googleauthurl @"https://accounts.google.com/o/oauth2/auth" #define googletokenurl @"https://accounts.google.com/o/oauth2/token" nsstring *const kkeychainitemname = @"calendar panel: google calendar"; - (instancetype)initwithviewcontroller: (uiviewcontroller*) viewcontroller; { self = [super init]; if (self) { _viewcontroller = viewcontroller; } return self; } - (bool)issignedin { nsstring *name = [self signedinusername]; return (name != nil); } - (nsstring *)signedinusername { // email address of signed-in user gtmoauth2authentication *auth = self.calendarservice.authorizer; bool issignedin = auth.canauthorize; if (issignedin) { return auth.useremail; } else { return nil; } } - (gtmoauth2authentication * )authforgoogle { //this url defined individual 3rd party apis, sure read documentation nsurl * tokenurl = [nsurl urlwithstring:googletokenurl]; // we'll make arbitrary redirecturi. controller watch // server redirect web view uri, uri not // loaded, need not actual web page. needs match uri set // redirect uri when configuring app instagram. nsstring * redirecturi = @"urn:ietf:wg:oauth:2.0:oob"; gtmoauth2authentication * auth; auth = [gtmoauth2authentication authenticationwithserviceprovider:@"lifebeat" tokenurl:tokenurl redirecturi:redirecturi clientid:googleclientid clientsecret:googleclientsecret]; auth.scope = @"https://www.googleapis.com/auth/userinfo.profile"; return auth; } - (void)signintogoogle { if (![self issignedin]) { gtmoauth2authentication * auth = [self authforgoogle]; // display authentication view gtmoauth2viewcontrollertouch * viewcontroller = [[gtmoauth2viewcontrollertouch alloc] initwithauthentication:auth authorizationurl:[nsurl urlwithstring:googleauthurl] keychainitemname:@"googlekeychainname" delegate:self finishedselector:@selector(viewcontroller:finishedwithauth:error:)]; [[self.viewcontroller navigationcontroller] pushviewcontroller:viewcontroller animated:yes]; } else nslog(@"something wrong sign in procedure!"); } - (void)viewcontroller:(gtmoauth2viewcontrollertouch * )viewcontroller finishedwithauth:(gtmoauth2authentication * )auth error:(nserror * )error { nslog(@"finished"); nslog(@"auth access token: %@", auth.accesstoken); self.calendarservice.authorizer = auth; [[self.viewcontroller navigationcontroller] poptoviewcontroller:self.viewcontroller animated:no]; if (error != nil) { uialertview * alert = [[uialertview alloc] initwithtitle:@"error authorizing google" message:[error localizeddescription] delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; } else { uialertview * alert = [[uialertview alloc] initwithtitle:@"success authorizing google" message:[error localizeddescription] delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; } } - (void)fetchcalendarlist { self.calendarlist = nil; self.calendarlistfetcherror = nil; gtlservicecalendar *service = self.calendarservice; gtlquerycalendar *query = [gtlquerycalendar queryforcalendarlistlist]; self.calendarlistticket = [service executequery:query completionhandler:^(gtlserviceticket *ticket, id calendarlist, nserror *error) { // callback self.calendarlist = calendarlist; self.calendarlistfetcherror = error; self.calendarlistticket = nil; nslog(@"fetched number of calendars: %@", self.calendarlist); //[self updateui]; }]; //[self updateui]; } - (gtlservicecalendar *)calendarservice { static gtlservicecalendar *service = nil; if (!service) { service = [[gtlservicecalendar alloc] init]; // have service object set tickets fetch consecutive pages // of feed not need manually fetch them service.shouldfetchnextpages = yes; // have service object set tickets retry temporary error conditions // automatically service.retryenabled = yes; } return service; } @end
this console output:
2014-09-10 23:57:53.603 calendarpanel[24383:60b] gtldrivechannel (api#channel) registration conflicts gtlcalendarchannel 2014-09-10 23:57:53.607 calendarpanel[24383:60b] gtlplusdomainsacl (plus#acl) registration conflicts gtlplusacl 2014-09-10 23:57:53.607 calendarpanel[24383:60b] gtlplusdomainsactivity (plus#activity) registration conflicts gtlplusactivity 2014-09-10 23:57:53.608 calendarpanel[24383:60b] gtlplusdomainsactivityfeed (plus#activityfeed) registration conflicts gtlplusactivityfeed 2014-09-10 23:57:53.608 calendarpanel[24383:60b] gtlplusdomainscomment (plus#comment) registration conflicts gtlpluscomment 2014-09-10 23:57:53.609 calendarpanel[24383:60b] gtlplusdomainscommentfeed (plus#commentfeed) registration conflicts gtlpluscommentfeed 2014-09-10 23:57:53.609 calendarpanel[24383:60b] gtlpluspeoplefeed (plus#peoplefeed) registration conflicts gtlplusdomainspeoplefeed 2014-09-10 23:57:53.610 calendarpanel[24383:60b] gtlplusperson (plus#person) registration conflicts gtlplusdomainsperson 2014-09-10 23:57:53.610 calendarpanel[24383:60b] gtlplusplace (plus#place) registration conflicts gtlplusdomainsplace 2014-09-10 23:57:53.613 calendarpanel[24383:60b] gtlstoragechannel (api#channel) registration conflicts gtldrivechannel 2014-09-10 23:57:53.986 calendarpanel[24383:60b] fetched number of calendars: (null)
my 2 questions is: 1. how can rid of these conflicts? 2. code ok want do? (fetch calendars user) think using gdata classes tricky , there limited/or outdated information out there.
instead of installing entire pod try use subpods
pod 'google-api-client/calendar', '~> 1.0'
or whichever need
pod 'google-api-client/drive', '~> 1.0'
Comments
Post a Comment