首页 > 解决方案 > 谷歌日历日历列表、事件列表

问题描述

我在我的一个 iOS 应用程序中使用 GTMAppAuth SignIn 进行身份验证。有了这个,我定义了所有可能的谷歌日历使用范围,但仍然出现以下错误。谷歌控制台上启用了谷歌日历 API 和 CalDAV API,但我仍然不知道为什么会出现这个错误。我还为谷歌 API 添加了范围如下图所示。

在此处输入图像描述

my code is given below:


-(void) fetchCalendarList
 {
    self.calendarList = nil;
    self.calendarListFetchError = nil;

    id<GTMFetcherAuthorizationProtocol> authorization =
    [GTMAppAuthFetcherAuthorization authorizationFromKeychainForName:kGTMAppAuthKeychainItemName];

    self.calendarService.authorizer = authorization;
    GTLRCalendarService *service = self.calendarService;

    GTLRCalendarQuery_CalendarListList *query = [GTLRCalendarQuery_CalendarListList query];

//    query.minAccessRole = kGTLRCalendarMinAccessRoleOwner;
//  query.minAccessRole = kGTLRCalendarOrderByStartTime;


    self.calendarListTicket = [service executeQuery:query
                                  completionHandler:^(GTLRServiceTicket *callbackTicket,
                                                      id calendarList,
                                                      NSError *callbackError) {
                                      // Callback
                                      self.calendarList = calendarList;
                                      self.calendarListFetchError = callbackError;
                                      self.calendarListTicket = nil;
                                      [self fetchEvents];
                                  }];
}

 i am getting this error:

Printing description of callbackError:
Error Domain=com.google.GTLRErrorObjectDomain Code=403 "Insufficient Permission" UserInfo={GTLRStructuredError=GTLRErrorObject 0x1c065adc0: {message:"Insufficient Permission" errors:[1] code:403}, NSLocalizedDescription=Insufficient Permission}

标签: iosobjective-cgoogle-calendar-api

解决方案


推荐阅读