totalMessageCount: and unreadMessageCount: usage #83

Closed
raneri opened this Issue Mar 17, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@raneri

raneri commented Mar 17, 2013

Hello, I don't understand how to use these two methods:

  • (BOOL)totalMessageCount:(NSUInteger *)totalCount;
  • (BOOL)unreadMessageCount:(NSUInteger *)unseenCount;

They return BOOL and expect a NSUInteger as argument, but I'm expecting them to RETURN the count of messages in the folder, can you explain the logic between this?

I've tried to do:
[inbox totalMessageCount:nil];
where inbox is CTCoreFolder that I got with folderWithPath:

But I receive a EXC_BAD_ACCESS from the method, on line:
*totalCount = [self imapSession]->imap_selection_info->sel_exists;

@gmaletic

This comment has been minimized.

Show comment Hide comment
@gmaletic

gmaletic Mar 18, 2013

I misread this too, the first time I saw it. The methods don't take
NSUInteger arguments: they take pointers to NSUIntegers. So here's what you
should do:

NSUInteger totalCount = 0;
BOOL success = [myFolder totalMessageCount:&totalCount];

...then totalCount will hold the value you're looking for.

On Sun, Mar 17, 2013 at 4:43 AM, raneri notifications@github.com wrote:

Hello, I don't understand how to use these two methods:

  • (BOOL)totalMessageCount:(NSUInteger *)totalCount;
  • (BOOL)unreadMessageCount:(NSUInteger *)unseenCount;

They return BOOL and expect a NSUInteger as argument, but I'm expecting
them to RETURN the count of messages in the folder, can you explain the
logic between this?

I've tried to do:
[inbox totalMessageCount:nil];
where inbox is CTCoreFolder that I got with folderWithPath:

But I receive a EXC_BAD_ACCESS from the method, on line:
*totalCount = [self imapSession]->imap_selection_info->sel_exists;


Reply to this email directly or view it on GitHubhttps://github.com/mronge/MailCore/issues/83
.

I misread this too, the first time I saw it. The methods don't take
NSUInteger arguments: they take pointers to NSUIntegers. So here's what you
should do:

NSUInteger totalCount = 0;
BOOL success = [myFolder totalMessageCount:&totalCount];

...then totalCount will hold the value you're looking for.

On Sun, Mar 17, 2013 at 4:43 AM, raneri notifications@github.com wrote:

Hello, I don't understand how to use these two methods:

  • (BOOL)totalMessageCount:(NSUInteger *)totalCount;
  • (BOOL)unreadMessageCount:(NSUInteger *)unseenCount;

They return BOOL and expect a NSUInteger as argument, but I'm expecting
them to RETURN the count of messages in the folder, can you explain the
logic between this?

I've tried to do:
[inbox totalMessageCount:nil];
where inbox is CTCoreFolder that I got with folderWithPath:

But I receive a EXC_BAD_ACCESS from the method, on line:
*totalCount = [self imapSession]->imap_selection_info->sel_exists;


Reply to this email directly or view it on GitHubhttps://github.com/mronge/MailCore/issues/83
.

@raneri

This comment has been minimized.

Show comment Hide comment
@raneri

raneri Mar 18, 2013

@gmaletic Thank you very much, it works!!!!

I think it would be better to fix the comments inside CTCoreFolder.h -- it currently says:
-- Returns the number of messages in the folder.
And:
-- @return Return YES on success, NO on error.
It is a little ambiguous.

raneri commented Mar 18, 2013

@gmaletic Thank you very much, it works!!!!

I think it would be better to fix the comments inside CTCoreFolder.h -- it currently says:
-- Returns the number of messages in the folder.
And:
-- @return Return YES on success, NO on error.
It is a little ambiguous.

@lichuanjun

This comment has been minimized.

Show comment Hide comment
@lichuanjun

lichuanjun Mar 19, 2013

hah,it is a point parameter.you should pass a &totalCount.

hah,it is a point parameter.you should pass a &totalCount.

@mronge mronge closed this in 8e7d1c5 Mar 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment