login about faq

I'm following this example for fetching oldest/newest emails in a loop to get the latests ones first, but it keep getting the emails from 64 and down, out a total of 116 emails.

http://www.example-code.com/ios/imap_fetchOldestNewest.asp

int numMessages = [[self NumMessages] intValue];

CkoEmail *newestEmail;
for (int emailNum = numMessages; emailNum > 0; emailNum--) {
    newestEmail = [self FetchSingle: [NSNumber numberWithInt:emailNum] bUid:YES];
    if (!(newestEmail == nil )) {
        NSLog(@"FromAddress: %@ Subject: %@", newestEmail.FromAddress, newestEmail.Subject);
    }
}

Am I doing something wrong? Because I copied and pasted the code from your examples, I just made it in a loop because the example pulls the latest email alone only. Thanks!

asked Sep 02 '14 at 11:21

emotality's gravatar image

emotality
462410


The 2nd argument to FetchSingle indicates whether the 1st argument is a UID or a sequence number. Given your code snippet, it is obvious you are passing sequence numbers, but you are incorrectly indicating UIDs (the 2nd are is bUid:YES. It should be bUid:NO)

link

answered Sep 02 '14 at 13:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Oh wow, thanks! This fixed this problem and my other problem, no need to email ou guys anymore. Instead of getting the sequence number it got the missing bUID number and crashed.

(Sep 02 '14 at 16:56) emotality
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×184
×175
×94
×34

Asked: Sep 02 '14 at 11:21

Seen: 1,119 times

Last updated: Sep 02 '14 at 16:56

powered by OSQA