If password not set before using MCOIMAPFetchFoldersOperation then application will segfault. Setting it to a blank password is enough to prevent the crash.
MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
[session setHostname:@"imap.gmail.com"];
[session setPort:993];
[session setUsername:email];
[session setPassword:@""]; // will crash if this line is commented out
[session setOAuth2Token:accessToken];
[session setConnectionType:MCOConnectionTypeTLS];
[session setAuthType:MCOAuthTypeXOAuth2];
session.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {
NSLog(@"data: %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
};
MCOIMAPFetchFoldersOperation *fetchFolderOperation = [session fetchAllFoldersOperation];
[fetchFolderOperation start:^(NSError *error, NSArray *folders) {
NSLog(@"%@", folders);
}];
If password not set before using MCOIMAPFetchFoldersOperation then application will segfault. Setting it to a blank password is enough to prevent the crash.