Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App reporting inaccurate Usage / Storage

One of my apps will, very occasionally, report its Storage (via Settings -> General -> Usage -> Storage) as 4GB when, in reality, the total size of all files in the app's Sandbox (Documents, Library, tmp) averages around 10MB or so.

I'm kind of at my wits end and wondering if anyone has experienced anything like this. I have a sneaking suspicion that it is something related to UIDocument, but can't be certain. It seems like too little to go on right now to file a radar.

In some instances the app will compel the system to present a dialog warning the user that the system is running low on storage. When this happens it seems the system reconciles the difference between the storage it thinks the app is using and reality and the storage numbers will then drop back down to 10MB or so.

It's really odd.

Any ideas on things I might look at would be appreciated.

The implementation of contentsForType:error:

- (id) contentsForType: (NSString *) inTypeName     error: (NSError **) outError {     NSFileWrapper       *newWrapper, *audioFileWrapper;     NSString            *audioFilename;     NSURL               *newAudioWrapperURL;      newWrapper = [[[NSFileWrapper alloc] initDirectoryWithFileWrappers: nil] autorelease];      // add updated info     [newWrapper addRegularFileWithContents: [NSKeyedArchiver archivedDataWithRootObject: self.testInfo] preferredFilename: QSDocumentInfoKey];      // scan audio files and clean up where needed     for (NSDictionary *wordInfo in self.wordInfoList) {         if ((audioFilename = [wordInfo objectForKey: QSInfoAudioKey]) != nil) {             newAudioWrapperURL = [self.fileURL URLByAppendingPathComponent: audioFilename];             if ([[NSFileManager defaultManager] fileExistsAtPath: [newAudioWrapperURL path]]) {                 audioFileWrapper = [[[NSFileWrapper alloc] initWithURL: newAudioWrapperURL options: 0 error: nil] autorelease];                 [newWrapper addFileWrapper: audioFileWrapper];             }         }     }      self.fileWrapper = newWrapper;      return self.fileWrapper; } 
like image 215
Casey Fleser Avatar asked Jan 27 '12 18:01

Casey Fleser


1 Answers

I've seen this with the TestFlight SDK. Removing the usage of TestFlight should resolve this problem.

like image 58
Bot Avatar answered Oct 04 '22 03:10

Bot