GTLServiceGmail fails to execute message list query when shouldFetchNextPages are set to true.

160 views
Skip to first unread message

Yuk Lai Suen

unread,
Jun 27, 2014, 1:55:33 PM 6/27/14
to gdata-objec...@googlegroups.com

- ( GTLServiceGmail *)gmailService

{

if (! _gmailService ) {

_gmailService = [ GTLServiceGmail new ];

// Have the service object set tickets to fetch consecutive pages

// of the feed so we do not need to manually fetch them.

// This will disable our manual fetching and the view will be only updated after all result is loaded.

_gmailService . shouldFetchNextPages = YES ;

// Have the service object set tickets to retry temporary error conditions

// automatically.

_gmailService . retryEnabled = YES ;

_gmailService . authorizer = [ self . accountgoogleAuth ];

    }

return _gmailService ;

}


- ( void )listMessagesMaxResults:( NSUInteger )maxResults completion:( void (^)( NSArray *messageIds))completion

{

GTLQueryGmail *query = [ GTLQueryGmail queryForUsersMessagesList ];

    query. userId = self . account . email ;

    query. maxResults = maxResults;

    [ self . gmailService executeQuery :query completionHandler :^( GTLServiceTicket *ticket, GTLGmailListMessagesResponse *object, NSError *error) {

    }];

}



If I run the listMessageMaxResults:completion:completion call above then an exception is thrown. The execution is not thrown if I don't set "shouldFetchNextPages" is set to NO (i.e. the default). Is this expected?

2014-06-27 10:53:40.398 Stitch[57164:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GTLGmailListMessagesResponse items]: unrecognized selector sent to instance 0xf3c6200'

*** First throw call stack:

(

0   CoreFoundation                      0x052855e4 __exceptionPreprocess + 180

1   libobjc.A.dylib                     0x04ec78b6 objc_exception_throw + 44

2   CoreFoundation                      0x05322903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275

3   CoreFoundation                      0x0527590b ___forwarding___ + 1019

4   CoreFoundation                      0x052754ee _CF_forwarding_prep_0 + 14

5   Stitch                              0x00275c63 -[GTLService mergedNewResultObject:oldResultObject:forQuery:] + 2563

6   Stitch                              0x002726c3 -[GTLService handleParsedObjectForFetcher:] + 771

7   libobjc.A.dylib                     0x04ed981f -[NSObject performSelector:withObject:] + 70

8   Foundation                          0x0490f9d8 __NSThreadPerformPerform + 285

9   CoreFoundation                      0x0520e83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

10  CoreFoundation                      0x0520e1cb __CFRunLoopDoSources0 + 235

11  CoreFoundation                      0x0522b29e __CFRunLoopRun + 910

12  CoreFoundation                      0x0522aac3 CFRunLoopRunSpecific + 467

13  CoreFoundation                      0x0522a8db CFRunLoopRunInMode + 123

14  GraphicsServices                    0x067189e2 GSEventRunModal + 192

15  GraphicsServices                    0x06718809 GSEventRun + 104

16  UIKit                               0x026bbd3b UIApplicationMain + 1225

17  Stitch                              0x00015f08 main + 216

18  libdyld.dylib                       0x05a19701 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException


Greg Robbins

unread,
Jun 27, 2014, 2:35:50 PM 6/27/14
to gdata-objec...@googlegroups.com
The Gmail API is unfortunately not compatible with the library's auto-pagination support. shouldFetchNextPages should not be set by the app.

Chinnasamy C

unread,
Feb 8, 2015, 7:07:27 AM 2/8/15
to gdata-objec...@googlegroups.com

let newQuery: GTLQueryGmail = GTLQueryGmail . queryForUsersMessagesList () as GTLQueryGmail

        newQuery. maxResults = 30

self . gmailService . executeQuery (newQuery, delegate: self , didFinishSelector: Selector ( "completionHandler:messageRespone:error:" ))


Use this code to pull last 30 mails from your inbox. If you have any queries about google api please contact chinna...@yahoo.com
Reply all
Reply to author
Forward
0 new messages