StorageSettings.bundle: Difference between revisions

From iPhone Development Wiki
(Created page with "{{infobox Framework | vis = Private | since = 11.0 | classID = ST }} StorageSettings.bundle is the preference bundle used to view storage information. == Getting the disk us...")
(No difference)

Revision as of 20:13, 4 May 2020

StorageSettings.bundle
Private Framework
Availabile 11.0 – present
Class Prefix ST
Headers [headers.cynder.me]


StorageSettings.bundle is the preference bundle used to view storage information.

Getting the disk usage as reported by the Settings app

To get the disk usage that is reported in the Storage settings, one can use this code snippet:

NSBundle *storageSettingsBundle = [NSBundle bundleWithPath:@"/System/Library/PreferenceBundles/StorageSettings.bundle"];
[storageSettingsBundle load];
STStorageDiskMonitor *monitor = [objc_getClass("STStorageDiskMonitor") sharedMonitor];
[monitor updateDiskSpace];

long long totalDiskSpace = monitor.deviceSize;
long long usedDiskSpace = totalDiskSpace - monitor.lastFree;

// Do stuff with totalDiskSpace and usedDiskSpace