使用gmail Query -queryForUsersThreadsList时,无法从线程列表中获取消息数组

时间:2016-04-28 08:49:39

标签: ios objective-c gmail-api

我们正在开发gmail App。

当我们使用查询获取线程列表时 - “queryForUsersThreadsList”

我们无法获得消息列表

请在下面找到代码

 - (void)fetchAllMails {
[self showLoader];
GTLQueryGmail *query = [GTLQueryGmail queryForUsersThreadsList];
NSString * strQuery = [[NSUserDefaults standardUserDefaults]valueForKey:@"priorityQuery"];
query.q = [NSString stringWithFormat:@"%@ OR %@ ",strQuery,[DataManager sharedManager].contactString];
[self.service executeQuery:query
                  delegate:self
         didFinishSelector:@selector(displayThreadListWithTicket:finishedWithObject:error:)];
}


- (void)displayPriorityMessageListWithTicket:(GTLServiceTicket *)ticket
                      finishedWithObject:(GTLGmailListThreadsResponse *)emailsResponse error:(NSError *)error
{
if (error == nil)
{
    //[self hideLoader];
    NSMutableString *labelString = [[NSMutableString alloc] init];
    nxtPageToken = emailsResponse.nextPageToken;
    [[NSUserDefaults standardUserDefaults]setObject:emailsResponse.nextPageToken forKey:@"priorityNextPageToken"];
    NSLog(@"%@",emailsResponse.threads);
    for(GTLGmailThread *thread in emailsResponse.threads){
        NSLog(@"historyId --- %@",thread.historyId);
        NSLog(@"messages ----- %@",thread.messages);
        NSArray *arrMessage = thread.messages;
        NSLog(@"snippet ---- %@",thread.snippet);
        NSLog(@"identifier --- %@",thread.identifier);
    }
}

所以我们得到 arrMessage = nil;

控制台

消息-----

以下是响应: -

{
nextPageToken = 06476267169132000279;
resultSizeEstimate = 250;
threads =     (
            {
        historyId = 153697;
        id = 1546076d7fd73764;
        snippet = "Hi , mobile";
    },
            {
        historyId = 153626;
        id = 15460736289d4f7d;
        snippet = "";
    },
           );
 }

上面json中的Thread字典不包含密钥消息,即消息数组

任何建议。 提前谢谢。

0 个答案:

没有答案