Skip to content

[Bug] - App Crash on 'fetchMessagesByUIDOperationWithFolder:requestKind:uids: #2000

@karam28

Description

@karam28

Summary
I'm utilizing MailCore2 via CocoaPods. After copying the Objective-C code, my application crashes upon running. The crash is associated with a deprecated method mentioned in the warning from Xcode: 'fetchMessagesByUIDOperationWithFolder:requestKind:uids:'.

Platform(s)

<iOS>

Happens on Mail Server

<Yahoo>

Piece of code

    MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
    [session setHostname:@"imap.mail.yahoo.com"];
    [session setPort:993];
    [session setUsername:@"[email protected]"];
    [session setPassword:@"xxxx"];
    [session setConnectionType:MCOConnectionTypeTLS];

    MCOIMAPMessagesRequestKind requestKind = MCOIMAPMessagesRequestKindHeaders;
    NSString *folder = @"INBOX";
    MCOIndexSet *uids = [MCOIndexSet indexSetWithRange:MCORangeMake(1, UINT64_MAX)];

    MCOIMAPFetchMessagesOperation *fetchOperation = [session fetchMessagesByUIDOperationWithFolder:folder requestKind:requestKind uids:uids];

    [fetchOperation start:^(NSError * error, NSArray * fetchedMessages, MCOIndexSet * vanishedMessages) {
        //We've finished downloading the messages!

        //Let's check if there was an error:
        if(error) {
            NSLog(@"Error downloading message headers:%@", error);
        }

        //And, let's print out the messages...
        NSLog(@"The post man delivereth:%@", fetchedMessages);
    }];

Actual outcome
it should not crash. Please provide the updated method and update that in your documentation also.

Connection Logs



**Expected outcome**

**Link to sample code on GitHub reproducing the issue (a full Xcode project):**

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions