应用报告不准确的使用/存储

Cas*_*ser 28 objective-c nsfilewrapper ipad ios

我的其中一个应用程序非常偶尔会将其存储(通过设置 - >常规 - >使用 - >存储)报告为4GB,实际上,应用程序沙箱(文档,库,tmp)中所有文件的总大小平均值大约10MB左右.

我有点在我的智慧结束,并想知道是否有人经历过这样的事情.我怀疑这是与UIDocument有关的东西,但不能肯定.现在提交雷达似乎太少了.

在某些情况下,应用程序将强制系统显示一个对话框,警告用户系统存储空间不足.当发生这种情况时,似乎系统会协调它认为应用程序正在使用的存储与现实之间的差异,然后存储数量将下降到10MB左右.

这真的很奇怪.

关于我可能会看到的事情的任何想法将不胜感激.

contentsForType的实现:错误:

- (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;
}
Run Code Online (Sandbox Code Playgroud)

Bot*_*Bot 1

我在 TestFlight SDK 中看到了这一点。删除 TestFlight 的使用应该可以解决此问题。