-1

アプリにダウンロードできる PDF サイズを制限できる設定がアプリにあります。

ダウンロードしたPDFのサイズがそのサイズを超えると、一部のPDFが削除されます。

PDFをダウンロードしてdocumentsフォルダに保存します。

次に、このガイドラインに従わないため、私のアプリは拒否されました。私が知る限り、PDFファイルをdocumentsフォルダーにダウンロードすることはできますが、スキップしてiCloudにバックアップすることができますNSURLIsExcludedFromBackupKey.

だから私の質問は、NSURLIsExcludedFromBackupKeyPDFを保存するときに持っていても大丈夫ですか?Appleによって再度拒否されることはありませんか?

4

1 に答える 1

1

同じ理由でアプリが拒否されたことがあります。ダウンロードしたファイルをバックアップから除外した後、承認されました。その属性を設定するには、次の方法を使用しています。

// We do not want to backup this file to iCloud
+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL {
    const char* filePath = [[URL path] fileSystemRepresentation];
    const char* attrName = "com.apple.MobileBackup";
    if (&NSURLIsExcludedFromBackupKey == nil) {
        // iOS 5.0.1 and lower
        u_int8_t attrValue = 1;
        int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
        return result == 0;
    } else {
        // First try and remove the extended attribute if it is present
        int result = getxattr(filePath, attrName, NULL, sizeof(u_int8_t), 0, 0);
        if (result != -1) {
            // The attribute exists, we need to remove it
            int removeResult = removexattr(filePath, attrName, 0);
            if (removeResult == 0) {
                NSLog(@"Removed extended attribute on file %@", URL);
            }
        }

        // Set the new key
        return [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil];
    }
}

ファイルがキャッシュに残るかどうかを制御できないため、キャッシュの使用はオプションではないとおっしゃいました。カスタムキャッシュを使用することでこれを解決できます。そのサンプルを見たい場合は、https ://github.com/evermeer/EVURLCache をご覧ください。

于 2013-02-22T07:15:03.440 に答える