Ever since upgrading to iOS 4 on my iPhone 3G and then on the new iPhone 4 I have been seeing problems connecting to my local Exchange server when I was on wifi. Even with previous versions of the OS, the iPhone never seemed to do Push reliably on when on the same wifi network as the Exchange server. The problems with iOS 4, however, seem more severe. Even force-checking the email on wifi would result in the phone just sitting there “connecting..” but never actually working.
Tonight I decided to take some time to look into it – and I think I have it fixed. Maybe this will help some others with the same problems (and judging by various forums, there are plenty of you out there).
The issue boiled down to a combination of iOS 4 being unable to resolve DNS names ending in .local and my local DNS configuration. The mail server hostname I the phone was accessing wasn’t .local since it’s publicly accessible, but it did have a CNAME DNS record on my internal DNS server that aliased to the .local name of the server. On a hunch I removed the CNAME and just made an A record point to the local ip address of the server, rebooted the phone, and voila! My local Exchange mail works as it should!
To to summarize – don’t have any .local names involved in the lookup of your mail server. Change your DNS config if you can, and reboot the phone.