Don't Backup to iCloud but still rejected

前端 未结 1 1611
感动是毒
感动是毒 2021-01-31 20:28

In my app i have to store Core Data Database and audio files, so i decoded to put them in Documents directory. To prevent them from backing up, when i first launch the app, i pu

1条回答
  •  梦如初夏
    2021-01-31 21:21

    The problem is with iOS 5.0, in this iOS you should not put the dont backup flag The dont back up flag was introduced in ios 5.0.1 We did face similar problem with our app, it has been rejected several times So we had to do a work around to handle different iOSes We needed to support iOS < 5.0, iOS 5.0, and iOS > 5.0

    So after contacting apple, we didnt find any solution except to have different paths on different iOSes

    We had a function like this:

    + (NSString*) savePath
    {
        NSString *os5 = @"5.0";
    
        NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
        NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    
        if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedAscending) //lower than 4
        {
            return path;
        }
        else if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedDescending) //5.0.1 and above
        {        
            return path;
        }
        else // IOS 5
        {
            path = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
            return path;
        }
    
        return nil;
    }
    

    We used and still use this function.

    Please read more

    iOS 5.0

    It is not possible to exclude data from backups on iOS 5.0. If your app must support iOS 5.0, then you will need to store your app data in Caches to avoid that data being backed up. iOS will delete your files from the Caches directory when necessary, so your app will need to degrade gracefully if it's data files are deleted.

    http://developer.apple.com/library/ios/#qa/qa1719/_index.html

    0 讨论(0)
提交回复
热议问题