2013-05-13 87 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上存儲。

相關問題