Friday, March 11, 2016

iOS Data Storage issue - Rejected even after NSURLIsExcludedFromBackupKey

Leave a Comment

My app is rejected from app store multiple times for not following 'iOS Data Storage Guidelines'. I have marked all document directories with "do not back up" attribute as suggested by apple review team, as shown:

- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString {     NSURL* URL= [NSURL URLWithString:filePathString];      NSError *error = nil;     BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]                                   forKey: NSURLIsExcludedFromBackupKey error: &error];      return success; } 

I have called the above addSkipBackupAttributeToItemAtPath method for all NSDocumentDirectory as shown :

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);     [self addSkipBackupAttributeToItemAtPath:[paths objectAtIndex:0]]; 

and review team says it is still storing some data as backup to iCloud and it is being rejected by Apple review team, actually i don't want anything to back up. Is there anything i have missed to Skip Backup Attribute? or anything wrong in my code? please help. Thank you.

2 Answers

Answers 1

Write this code in addSkipBackupAttributeToPath method. I had the same issue and was resolved by writing this code instead.

- (void)addSkipBackupAttributeToPath:(NSString*)path {    u_int8_t b = 1;    setxattr([path fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); } 

Answers 2

Try using the NSCachesDirectory instead of the NSDocumentDirectory, to store the subfolders/files.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment