Details On launch and content downloadについて、your app stores 15.83 MB on the user's iCloud、which does not comply with the iOS Data Storageが拒否されました.

3193 ワード

友人がappstoreに問題を起こした2.23 Details On launch and content download、your app stores 15.83 MB on the user's iCloud、which does not comply with the iOS Data Storageが拒否された.
2.23 Details On launch and content download, your app stores 15.83MB on the user's iCloud, which does not comply with the iOS Data Storage
これはdocumentsの下に大量のデータを格納する問題で、appStoreのiCloudはこの中のデータをバックアップします
解決策1:iCoudにデータをバックアップさせず、ICloudのバックアップをスキップする
アップルの解決策の住所:https://developer.apple.com/library/prerelease/content/qa/qa1719/_index.html
Object Cコード:
ios5.1 later
- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString
{
    NSURL* URL= [NSURL fileURLWithPath: filePathString];
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
 
    NSError *error = nil;
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                                  forKey: NSURLIsExcludedFromBackupKey error: &error];
    if(!success){
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
}

使用方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    [self addSkipBackupAttributeToItemAtPath:@"/Library/Caches"];

    return YES;
}

付録:urlのパスを取得する方法(実はあなたのファイルのパス):
NSArray * arrayOfURLs = [[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask];
// make certain there's at least one file url returned by the above call
if([arrayOfURLs count] > 0)
{
    // and this would just be the URL to the cache directory...
    NSURL * cacheDirectoryPath = [arrayOfURLs objectAtIndex: 0];

    // ... to create a file url to your actual dictionary, you'd need to add a
    // filename or path component.

    // Assuming you save this as a property within your object
    self.cacheFileURL = [cacheDirectoryPath URLByAppendingPathComponent: @"myDatabase.db"];
}

Swiftコード:
 func addSkipBackupAttributeToItemAtURL(filePath:String) -> Bool
    {
        let URL:NSURL = NSURL.fileURLWithPath(filePath)
 
        assert(NSFileManager.defaultManager().fileExistsAtPath(filePath), "File \(filePath) does not exist")
 
        var success: Bool
        do {
            try URL.setResourceValue(true, forKey:NSURLIsExcludedFromBackupKey)
            success = true
        } catch let error as NSError {
            success = false
            print("Error excluding \(URL.lastPathComponent) from backup \(error)");
        }
 
        return success
    }

使用方法
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        
        
        addSkipBackupAttributeToItemAtURL("     ")
        
        return true
    }

解決策2:Documentsフォルダに再利用したデータを置かない
1、         /tmp     
2、          /Library/Caches