George Garside Blog

If you find something useful on here, it's probably an accident.

I’ve suffered from an odd bug for a while on iOS 7, where the cellular data app preferences that I set in Settings → Cellular (Mobile in the UK) for each of the individual apps on my iOS 7 device wasn’t getting saved. I could slide the switch on or off, and when I leave the app and return, the settings would be back to how they were.

This became a large problem, especially on my limited data plan where every megabyte was precious and limited. I had to do something to fix this. The only thing I found that people seemed to find to fix it was to restore. However, I was their device probably wasn’t jailbroken.

My iPhone is jailbroken. This means that I can look in the device’s filesystem and see exactly the file that I need. I was expecting to look for the file and either see something blatantly wrong with it and fix it, or simply change the variables there instead of in the Settings app (I don’t change settings that often—I wouldn’t mind changing the setting in iFile/etc if required).

This wasn’t as easy as I expected. For starters, I couldn’t find the file. I was expecting a property list somewhere in ~/Library/Preferences, but that didn’t happen. After concluding that I must be looking in completely the wrong place, I got an answer from Andrew over at Ask Different.

The directory you’re looking for happens to be /var/wireless/Library/Preferences. This is where the Settings > Cellular settings are stored. The per-application settings are stored in the database /var/wireless/Library/Databases/CellularUsage.db.

With my new-found knowledge, I looked at the database at /var/wireless/Library/Databases/CellularUsage.db using Navicat on my Mac (over Netatalk) and found what I was looking for—all the app cellular data preferences. I could change a value and have the change reflected in Settings. This meant that Settings was reading the database but was for some reason unable to write to it. I tried many things including permissions on both the database and the app, but everything seemed fine.

Finally, I just tried deleting it from my device. Everything was back to normal—the settings were saving and the database was getting written to!

This has occurred again with the update to iOS 9. If you update to iOS 9 OTA (over-the-air), a bug can cause the CellularData.db to become corrupted. Unfortunately, a jailbreak isn't available for iOS 9 yet, which means that this fix doesn't apply yet. Once a jailbreak is released, this solution will work fine. Until then, a workaround is to restore iOS and not restore from your backup. This will create a new CellularData.db database which works fine.

iOS 9.0.2 update fixes this bug. You can install this update OTA through Settings → Software Update, or through iTunes.

This update contains bug fixes and improvements, including: Fixes an issue with the setting to turn on or off app mobile data usage

Need help?