【问题标题】:What is NSdocumentdirectory's limitation size?NSdocumentdirectory 的大小限制是多少?
【发布时间】:2014-12-12 23:40:34
【问题描述】:

NSDocumentdirectory 中的maximum size 可以是stored 是什么?

大多数情况下,我是NSDocumentdirectory 中的saving images,因为它是backed iCloud

现在我想know 可以存储的最大大小是多少。请帮忙。

【问题讨论】:

    标签: ios iphone nsdocumentdirectory


    【解决方案1】:

    这段代码给出了确切的字节数。

    - (unsigned long long int)folderSize:(NSString *)folderPath {
        NSArray *folderArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:folderPath error:nil];
        NSEnumerator *folderEnumerator = [folderArray objectEnumerator];
         NSString *folderName;
         unsigned long long int fileSize = 0;
    
         while (folderName = [folderEnumerator nextObject]) {
          NSDictionary *folderDictionary = [[NSFileManager defaultManager] fileAttributesAtPath:[folderPath stringByAppendingPathComponent:fileName] traverseLink:YES];
        folderSize += [folderDictionary folderSize];
    }
    
       return folderSize;
    }
    

    希望对你有帮助...

    【讨论】:

    • OP 想知道限制,而不是当前使用情况。
    • 是的,我想知道最大限制而不是大小。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-22
    • 2012-09-20
    • 1970-01-01
    • 2014-05-18
    相关资源
    最近更新 更多