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?
Hi fatshu and Andy,
while we work on fixing the root issue, doing this should temporarily make it work:
query.urlQueryParameters[@"strict"] = @"false";
(right before your call to executeQuery).
Cheers and sorry for the inconvenience,
Jorge
EDIT: As user3377170 correctly points out, the bug is now fixed and the workaround isn't necessary anymore.
This was a bug; it is now fixed.
It is no longer necessary to use the strict = false workaround that was mentioned here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With