iOS App Rejection due to 2.23 - iOS Data Storage Guidelines
Asked Answered
A

3

20

Here's message from Apple about rejection :

2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected 2.23 Details

On launch and content download, your app stores 6.5 MB, which does not comply with the iOS Data Storage Guidelines.

Next Steps

Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed.

Data that can be recreated but must persist for proper functioning of your app - or because users expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCRUFLIsExcludedFromBackupKey attribute.

I checked out the data files of my application both for device and simulator. I found that if app has used for a while, it's total app data could store 5-6 MB, on launch. But I uninstalled and re-installed app and checked again, I see ~3MB data store on launch of app.

I'm not storing any Core Data databases or any other database files. But I've realized that Google Analytics and Google Tag Manager stores some sqlite data on this path : "AppData/Library". I mean it does NOT store on this path : "AppData/Library/Caches". Does it make any difference for iOS Data Storage Guidelines?

By the way, iCloud is disabled for application.

Also I'm using SDWebImage for downloading images and it stores almost 3 MB images on the launch and it stores image data on this path : "AppData/Library/Caches"

Do you have any idea that what should I do to handle this issue?

Arbour answered 1/3, 2015 at 16:28 Comment(11)
I've got the same message from Apple recently. Do you store any data in /Documents/ or other location?Plump
@Plump yes, Adjust and ad-x (third party marketing libraries) stores a few files in /Documents directory. What is the point of it?Arbour
According to Apple rules /Documents should contain nothing but user created data. Otherwise, NSURLIsExcludedFromBackupKey must be set (to prevent syncing to iCloud). So, my suggestion, you have to set NSURLIsExcludedFromBackupKey manually for every file in /Documents.Plump
@Plump thanks i will check out Documents directory again, but i disabled icloud for application. Do you know that iCloud stores data in /Documents even i disabled iCloud?Arbour
In case of iCloud Backup by default - YES. Check this: #8753013Plump
@Plump Thanks so much. I got it about iCloud backup process. By the way, I checked my /Documents folder and there are 4 files which third party SDKs generated, like Adjust.io and AdX (marketing tools). Do you think that I should turn them off or just trying to add the NSURLIsExcludedFromBackupKey?Arbour
Depends on you. If you want to use 'em, setting NSURLIsExcludedFromBackupKey should be enough.Plump
@Plump These third party libraries set NSURLIsExcludedFromBackupKey to YES. I found that in source code.Arbour
In your place , I would double check all /Documents files in runtime (log NSURLIsExcludedFromBackupKey values). If it's ok - start discussion at Resolution center .Plump
@Plump okay i will check in runtime. Also do you have idea why do they mention size of storage (6.5MB) persistently? Because in /Documents files are too small.Arbour
I think it's your app size + all files in /Documents, /Library/Cache. etc.Plump
N
25

I just got the same rejection message yesterday.

I use the following code in application:didFinishLaunchingWithOptions: to see what my application has inside the documents folder and what is the permission of each item about iCloud backup:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSArray *documents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:basePath error:nil];
NSURL *URL;
NSString *completeFilePath;
for (NSString *file in documents) {
    completeFilePath = [NSString stringWithFormat:@"%@/%@", basePath, file];
    URL = [NSURL fileURLWithPath:completeFilePath];
    NSLog(@"File %@  is excluded from backup %@", file, [URL resourceValuesForKeys:[NSArray arrayWithObject:NSURLIsExcludedFromBackupKey] error:nil]);
}

I had some files inside that folder that were synchronising with iCloud. So instead of saving those files in another place I set the resource value for the NSURLIsExcludedFromBackupKey key set to YES to exclude those files from being backed up by iCloud, like this:

NSURL *URL = [NSURL fileURLWithPath:photoPath];
[URL setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:nil];

I'm sending my app again today to see if works.

Hope this help.

Nauplius answered 21/3, 2015 at 12:4 Comment(5)
Just to update you guys, my app was accepted after this modification. :)Nauplius
I'm curious how review team discover the size, thus I follow the steps as they mentioned, the number I saw is a few KB, not some 100 MB. I also check in the application:didFinishLaunchingWithOptions from the snippet by @Glauco Neves and there's none. We reply to review team withe the screenshot of iCloud, they still address that the app stores 134.34 MB when reviewing the iOS Data Storage..Fulltime
I'm experiencing the same problem. They are telling me that I'm using 6Mb. Exactly what they say is: "On launch and content download, your app stores 6.32MB on the user's iCloud, which does not comply with the iOS Data Storage Guidelines." However i don't have enabled iCloud in my App... @Bastet have you been able to solve the problem? With Glauco Neves code i wasn't able.Lyre
@Miguel, after another code review, we found there's a folder we missed to set this option. We've passed the review now.Fulltime
@Lyre did you manage to fix it? I don't know what might be causing the issue. Is it some third-party libraries?Rainer
R
7

Recently, we were rejected by Apple Review Team with the same issue,

On launch and content download, your app stores 9.65MB on the user's iCloud, which does not comply with the iOS Data Storage Guidelines.

They suggest to follow the same Next Steps as mentioned in the question above.

In our case, we are already setting this NSURLIsExcludedFromBackupKey in the code when downloading contents. We informed the review team that we are already doing this, so they redirected us to Apple Developer Technical Support (DTS) to better address the issue.

DTS replied that it is our AppIcon files that are causing the issue.

The AppIcons are being backed up in iCloud as Apple requires to display an icon on the device while the app is being downloaded. It turns out that our app's AppIcons files are so big that caused the rejection because it is backing up a lot of data to iCloud. This was not communicated clearly to us by the App Review team as some of them are not aware of this new tool changes that track the AppIcons.

Now that we know the reason, we optimized our icons using ImageOptim and minimized the size to 75KB.

We submitted our app and hopefully it will be approved in 1 to 2 days. :)

I hope this helps someone who has the same issue. :)

Rainer answered 15/7, 2016 at 3:17 Comment(6)
I think I have the same issue. Thank you for sharing!Prejudice
Glad to have helped you. Hope this solution works for you. :) @PrejudiceRainer
Thank you for posting this. I suspect I'm hitting the same issue. They are saying my app uses 6.7 MB of iCloud storage but it only shows about 6 KB in iCloud settings. However my app icons take up ~10 MB.Eatables
Ok, let me know if Apple Review team approves your app after optimizing the app icons. :) @EatablesRainer
@Rainer My app was approved after optimizing the icons.Eatables
@Eatables Glad to know. :)Rainer
S
5

Ran into this same issue recently and just translated Glauco's answer to Swift (though it could probably be written more Swiftly)

let directories = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true)
    if let documentDirectory = directories.first {
        do {
            let documents = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(documentDirectory)
            for files in documents {
                let urlForm = NSURL.fileURLWithPath(documentDirectory + "/" + files)
                do {
                    try print("\(files): \(urlForm.resourceValuesForKeys([NSURLIsExcludedFromBackupKey]))")
                } catch {
                    print("can't find key")
                }
            }
        } catch {
            print("can't retrieve contents")
        }
    }

Code to setResourceValue

let urlToExclude = NSURL.fileURLWithPath(quoteSavePath!)
    do {
        try urlToExclude.setResourceValue(NSNumber(bool: true), forKey: NSURLIsExcludedFromBackupKey)
    } catch { print("failed to set resource value") }
Soundless answered 25/1, 2016 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.