I wrote the following function to modify the message by marking it unread:
- (void)modifyMessageWithId:(NSString *)gmailMessageId
{
__block GTLQueryGmail *query;
query = [GTLQueryGmail queryForUsersMessagesModify];
query.identifier = gmailMessageId;
query.addLabelIds = @[@"UNREAD"];
[self.gmailService executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLGmailMessage *result, NSError *error) {
// Check result here
}];
}
Then I checked the result and there's an error saying the id (which I think means the query.identifier
I set) is an unknown field name. I also tried to set query.messageId
instead and got a similar error:
(lldb) po error
Error Domain=com.google.GTLJSONRPCErrorDomain Code=400 "The operation couldn’t be completed. (Unknown field name: id)" UserInfo=0xdd37e70 {error=Unknown field name: id, GTLStructuredError=GTLErrorObject 0xdd37cd0: {message:"Unknown field name: id" code:400 data:[1]}, NSLocalizedFailureReason=(Unknown field name: id)}
Any ideas how to do this?
This was a bug; it is now fixed.
It is no longer necessary to use the strict = false workaround that was mentioned here.