写个宏方法
#define AddSkipBackupAttributeToItemAtPath(filePathString) \
{ \
NSURL* URL= [NSURL fileURLWithPath: filePathString]; \
if([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]){ \
[URL setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: nil]; \
} \
{ \
NSURL* URL= [NSURL fileURLWithPath: filePathString]; \
if([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]){ \
[URL setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: nil]; \
} \
}
在需要的地方这样调用
AddSkipBackupAttributeToItemAtPath(MAP_FILE_DATA_PATH);