Archived Forum Post

Index of archived forum posts

Question:

Takes time to load email objective c ios

Jul 18 '12 at 02:31

I am using chilkat ios library to fetch email from mail server, i am using following code to fetch emails .... CkoMessageSet messageSet; messageSet = [imap Search: @"ALL" bUid: fetchUids]; CkoEmailBundle bundle; bundle = [imap FetchBundle: messageSet];
...

this takes lots of time to fetch emails if mail box size is to large. please provide solution for this.

Thanks satish


Answer

Yes, that is correct. Downloading 1000 emails would generally take about 10 times longer than downloading 100 emails...


Answer

There are a number of solutions:

  1. Instead of calling FetchBundle, iterate over the messages in the message set and fetch them one at a time.
  2. Put your email fetching code in a background thread. I cannot provide general programming instruction for how to write multi-threaded programs. In general, when using background threads, your program should be thread-safe meaning that any shared object instances or other variables should not be simultaneously modified/accessed. You'll need to synchronize access to these things. (Chilkat objects are automatically thread-safe.) If a long-running task is in a background thread, then your foreground thread is free to handle the user-interface.
  3. Use event callbacks, such as periodic AbortCheck events, allowing you to manage user-interface updates. Again, I cannot provide general IOS user-interface programming advice. I can only provide information about the event callback behavior itself. (see http://www.chilkatforum.com/questions/292/event-callbacks-in-ios-objective-c )