2013-05-13 34 views

回答

1

但可以假设你在文件目录中保存了一些数据。苹果说,你必须标记这个数据,它不会被iCloud备份。 This might help.(不过这也应该是在你从苹果得到了答案。

1

默认情况下,存储在应用程序的文件目录中的所有数据备份到iCloud,苹果的iOS数据存储准则(发现here)指定的任何数据,可以由用户重新创建必须不会被备份到iCloud。

你有几个选择这里

  1. 将数据保存到<Application_Home>/Library/Caches<Application_Home>/tmp取决于你的使用情况

  2. 马克,你在文档目录与“不备份”标志保存(如解释here

1

要应用属性的所有文件:))文件(当然你可以排除需要)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

添加此。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 

[self applyAttributes:documentsDirectory];  

paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); 
documentsDirectory = [paths objectAtIndex:0]; 

[self applyAttributes:documentsDirectory]; 


paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
documentsDirectory = [paths objectAtIndex:0]; 

[self applyAttributes:documentsDirectory]; 



-(void)applyAttributes:(NSString *)folderPath 
{ 
    NSArray *filesArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:folderPath error:nil]; 
    NSEnumerator *filesEnumerator = [filesArray objectEnumerator]; 
    NSString *fileName; 

    while (fileName = [filesEnumerator nextObject]) { 

    if([self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:[folderPath stringByAppendingPathComponent:fileName]]]) 
    { 
     //NSLog(@"success applying"); 
    } 


} 

} 



- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL 
{ 
    if([[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; 
} 

return NO; 

} 
1

只需更改您的Cordova.plist文件。在备份存储中更改为cloud = none。 从科尔多瓦框架中引用帮助。 这不适用于本机应用程序。对于本机应用程序,开发者通知或认证用户该应用程序将在iCloud上存储。

相关问题