Wednesday, 30 September 2015

Background Use of Mobile Network on iPhone

What's with WIFI on the iPhone?

After reviewing my Apache logs to resolve a Davical problem on my wife's phone I discovered something very interesting. I put together a PHP script to enable the caldav messages to be monitored more easily (I based it on my Minecraft log script), and it gave me log messages like this... - rick [29/Sep/2015:00:16:00 +0100] "PROPFIND /davical/caldav.php/private/ HTTP/1.1" 207 2180 "-" "iOS/8.3 (12F70) dataaccessd/1.0" - rick [29/Sep/2015:00:16:01 +0100] "PROPFIND /davical/caldav.php/pingucal%3A8800/.well-known/carddav HTTP/1.1" 403 670 "-" "iOS/8.3 (12F70) dataaccessd/1.0" - rick [29/Sep/2015:00:16:01 +0100] "PROPFIND /davical/caldav.php/pingucal%3A8080/.well-known/carddav HTTP/1.1" 403 670 "-" "iOS/8.3 (12F70) dataaccessd/1.0" 

My phone was in fact connected to my home Wifi with an IP address of, but it was clearly using the Mobile network connection to talk to the Davical service because the log showed my phone was sending requests from

It won't fix!!

I tried lots of different things, resetting network settings, disabling various wifi options, and even turning off mobile networking. But when I viewed the Apache log it was still (as if by magic) logging connections from the mobile network IP address.

I was using iOS8.3 and couldn't find any listed problems with it, so I took the plunge and upgraded to iOS9. Twenty minutes and 1 gigabyte download later I was upgraded, but the problem remained. I gave up and went to bed with Mobile networks clearly OFF.

I viewed the logs the next day - every hour the phone accessed the Davical service from - rick [30/Sep/2015:06:32:09 +0100] "PROPFIND /davical/caldav.php/pingucal%3A8008/principals/ HTTP/1.1" 403 664 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0" - rick [30/Sep/2015:06:32:09 +0100] "PROPFIND /davical/caldav.php/pingucal%3A8800/principals/ HTTP/1.1" 403 664 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0" - rick [30/Sep/2015:06:32:09 +0100] "PROPFIND /davical/caldav.php/pingucal%3A8080/principals/ HTTP/1.1" 403 664 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0" 

Now that's surprising!!.. just what does that OFF button do then?

It's all about the Cache

While grabbing log entries for this blog tonight I discovered something quite baffling... it now appears to be using Wifi correctly. My phone continued to connect via 4G from work (using another IP address) - rick [30/Sep/2015:14:13:24 +0100] "PROPFIND /davical/caldav.php/pingucal/ HTTP/1.1" 207 2525 "-" "iOS/8.3 (12F69) dataaccessd/1.0" - rick [30/Sep/2015:14:17:03 +0100] "OPTIONS /davical/caldav.php/paulcal/ HTTP/1.1" 200 613 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0" 

Here half way through the afternoon we can also see an iOS/8.3 device, which is my iPad. It doesn't have a cellular networking radio, so it doesn't make sense that it should have that IP. Clearly there's some sort of caching going on with the Apache logging. My phone is showing as the iOS/9.0.1 device.

Once my iPhone connected to the Wifi it started showing correctly.. - rick [30/Sep/2015:19:04:32 +0100] "OPTIONS /davical/caldav.php/lehrlecal/ HTTP/1.1" 200 613 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0" - rick [30/Sep/2015:19:04:32 +0100] "PROPFIND /davical/caldav.php/lehrlecal/ HTTP/1.1" 207 2666 "-" "iOS/9.0.1 (13A404) dataaccessd/1.0"

So I can't trust the IP addresses in the Apache2 log. If you reset the Mobile Data statistics you can confirm for yourself that it isn't actually using Mobile data IF it's turned off. My faith in Apple has almost been restored,.. I'm sorry I ever doubted you!
BUT, with Mobile data turned on, the background process is showing it's being used instead of the Wifi connection. There might be a good reason for this, but as is often the case these days, as a consumer I have little or no control over it without turning the phone off or disabling Mobile data every evening.

Now I'm thinking I need to jailbreak my phone again!