1

I'm fetching messages on background from IMAP server using performFetchWithCompletionHandler. The first thing I do on method implementation is check for network reachability, discarding operation if its no available. Then I start refresh process executing fetchMessagesOperationWithFolder on a IMAP session.

As result of this operation I usually receive no error, but sometimes I receive an MCOErrorParse (Unable to parse response from server), MCOErrorConnection (A stable connection to the server could not be established) or MCOErrorAuthentication (Unable to authenticate with the current session's credentials).

Can all this errors be produced due to connection failure?

I want to handle the MCOErrorAuthentication to notify user on the credentials error, but in this scenario the credentials are ok, so when I perform any operation when on foreground again with network reachability it will succeed.

Should I do an extra network connection check before proceed on those errors? Should I create a new IMAP session on every operation?

Thanks!

Edit

I'm adding ConnectionLog, it take me long to reproduce the error. Its very clear why I receive a MCOErrorAuthentation: I'm not loading password well.

2014-12-18 21:00:41.212 * OK Gimap ready for requests from 85.58.177.133 et58mb78762219web
2014-12-18 21:00:41.222 1 CAPABILITY
2014-12-18 21:00:41.302 * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN
1 OK Thats all she wrote! et58mb78762219web
2014-12-18 21:00:41.304 2 LOGIN “polferresamon@gmail.com" ""
2014-12-18 21:00:41.378 2 NO Empty username or password. et58mb78762219web
2014-12-18 21:00:41.380 Error fetching messages: Unable to authenticate with the current session's credentials.

So, to really solve MCOErrorAuthentication I have to check IMAP session init, and the process where I'm loading email and password when returning from background.

I guess parse and connection errors are due to connection issues.

Thanks for your help.

polecito
  • 11
  • 2
  • Could you show the connectionLogger logs? – Dinh Viêt Hoà Dec 15 '14 at 19:58
  • Definitely my issue was caused by a KeyChain access misconfiguration. I just find the solution on this question: http://stackoverflow.com/questions/10536859/ios-keychain-not-retrieving-values-from-background – polecito Dec 20 '14 at 20:17

0 Answers0