Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Data Storage issue - Rejected even after NSURLIsExcludedFromBackupKey

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.

like image 778
Mumthezir VP Avatar asked Feb 26 '16 06:02

Mumthezir VP


1 Answers

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);
}
like image 71
Milan Gupta Avatar answered Sep 30 '22 18:09

Milan Gupta