Don't Understand App Rejection

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I got this app rejected today, and the following was in the Resolution Center:

2.23

We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.

In particular, we found that on launch and/or content download, your app stores downloaded media (MP3 files). To check how much data your app is storing:

- Install and launch your app
- Go to Settings > iCloud > Storage & Backup > Manage Storage
- If necessary, tap "Show all apps"
- Check your app's storage

The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., may be stored in the /Documents directory - and backed up by iCloud.

Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

Data that can be recreated but must persist for proper functioning of your app - or because customers 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 kCFURLIsExcludedFromBackupKey attribute.

For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

It is necessary to revise your app to meet the requirements of the iOS Data Storage Guidelines.
For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to:

- include the complete details of your rejection issues
- prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up.

For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

If you have difficulty reproducing this issue, please try testing the workflow as described in <https://developer.apple.com/library/ios/qa/qa1764/>Testing Workflow with Xcode's Archive feature".
All the app downloads is MP3s (and only when the user requests to download them), and it stores them in the Documents Directory. Are they saying this is not allowed?
 
Last edited by a moderator:

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
I made a thread about this a while back, they started rejecting apps for unnecesary downloading to the Documents Directory, you need to save it to the NSLibraryDirectory. So it's not alot of code change, but that should be it :)
Greetz, Noxx
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I made a thread about this a while back, they started rejecting apps for unnecesary downloading to the Documents Directory, you need to save it to the NSLibraryDirectory. So it's not alot of code change, but that should be it :)
Greetz, Noxx
Thanks, do you have a link to that thread? Would have been nice if they told people they were doing that, seeing as how all downloads were always before supposed to go to the Documents Directory.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Thanks, do you have a link to that thread? Would have been nice if they told people they were doing that, seeing as how all downloads were always before supposed to go to the Documents Directory.
http://forums.macrumors.com/showthread.php?t=1370644

Tada! :)

I've did some research and went through the guidelines, before they wanted you to copy it to NSDOcumentsDirectory, but that gets backupped to iCloud, to avoid syncing several gigs of people downloading PDF's etc in their app, Apple is rejecting applications who do "unnessecary" downloads to the Documents folder, in other meanings, if you can easily redownload it, or store it somewhere else, like the library.
They did a 'silent' change on that since iOS5.
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
http://forums.macrumors.com/showthread.php?t=1370644

Tada! :)

I've did some research and went through the guidelines, before they wanted you to copy it to NSDOcumentsDirectory, but that gets backupped to iCloud, to avoid syncing several gigs of people downloading PDF's etc in their app, Apple is rejecting applications who do "unnessecary" downloads to the Documents folder, in other meanings, if you can easily redownload it, or store it somewhere else, like the library.
They did a 'silent' change on that since iOS5.

Thanks for the info. I love iOS and everything about it, except the review process, length of reviews, and things like this. I feel better knowing that even Dejo didn't know about apps being rejected for downloading files to the NSDocumentDirectory.
 

larswik

macrumors 68000
Sep 8, 2006
1,552
11
I had my first app approved 3 weeks ago SYV Traveler for a tourist show that I create where I live. When the user starts the app for the first time if goes and gets all the content and downloads it from my server. It's only about 5 megs of images and text but I save all of that to NSDocuments Directory/clients/ client1/image1.jpg

The user never saves any of his stuff with the app it's just downloaded and it checks for updates every day and replaces out the image files if needed. This was not rejected by review process? I am wondering if I should switch to another folder when I update it? Or perhaps I fall under a different category?
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I had my first app approved 3 weeks ago SYV Traveler for a tourist show that I create where I live. When the user starts the app for the first time if goes and gets all the content and downloads it from my server. It's only about 5 megs of images and text but I save all of that to NSDocuments Directory/clients/ client1/image1.jpg

The user never saves any of his stuff with the app it's just downloaded and it checks for updates every day and replaces out the image files if needed. This was not rejected by review process? I am wondering if I should switch to another folder when I update it? Or perhaps I fall under a different category?
I've talked to some other developers and it is apparently only for things saved to the root of Documents. If you create a folder within Documents, and store in there, it won't get rejected.

I understand the reasoning behind it, I'd hate for one app to take up all my 5 GB free storage with iCloud, I just wish that it had been announced better to the developers, so we would know about it before getting an app rejected for it.
 

larswik

macrumors 68000
Sep 8, 2006
1,552
11
I guess it was dumb luck then with my app. When I first started writing it I created the clients folder because if I had problems I could just remove that folder and it would delete everything. I kept that architecture after that point and built upon it.

But if that is the case it would seem like a simple fix then to just alter your path and add a directory to the root directory then.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
I totally agree up to the point the Apple Review process is a real HELL.
So about the rejecting, I totally feel with you, and indeed, you can get lucky, there was no clear communication to developers, and I had to find out the hard way too. I hope I made some of that clear to you so you can finish it in another app :)
What I did was copy on startup everything to NSLibrary, and no troubles with that neither :) Also, Apple gave you a small hint like this:
"For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?."

Maybe you should check that out and head back! :)

Gz, Noxx
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I totally agree up to the point the Apple Review process is a real HELL.
So about the rejecting, I totally feel with you, and indeed, you can get lucky, there was no clear communication to developers, and I had to find out the hard way too. I hope I made some of that clear to you so you can finish it in another app :)
What I did was copy on startup everything to NSLibrary, and no troubles with that neither :) Also, Apple gave you a small hint like this:
"For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?."

Maybe you should check that out and head back! :)

Gz, Noxx
I put everything in the NSLibrary and it still got rejected for the exact same reason, so I guess I need to go the route of preventing backup. To prevent backup of the entire folder (I realize for the most part it is not wise to backup an entire folder, but in my situation, there is nothing in there besides the downloaded content) would this code work?


Code:
    - (NSString *)applicationDocumentsDirectory {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
	
	NSString *documentsDirectory = [paths objectAtIndex:0];

       NSURL *pathURL= [NSURL fileURLWithPath:documentsDirectory];
    [self addSkipBackupAttributeToItemAtURL:pathURL];
    return documentsDirectory;
    
}

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL

{ if (NSURLIsExcludedFromBackupKey) {
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
    
    
    
    NSError *error = nil;
    
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                    
                                  forKey: NSURLIsExcludedFromBackupKey error: &error];
    
    if(!success){
        
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
        
    }
    
    return success;
}
else {
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
    
    
    
    const char* filePath = [[URL path] fileSystemRepresentation];
    
    
    
    const char* attrName = "com.apple.MobileBackup";
    
    u_int8_t attrValue = 1;
    
    
    
    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
    
    return result == 0;
}
    
}
 
Last edited:

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
Normally NSLibrary doesn't get automatically backupped.. i'm a tad confused now. My apologies.
I am confused as well. My app sat in review for about 27 hours and then they sent that email about 2.23 data storage guidelines being violated. I kind of think the reviewer fell asleep, and they sent the same response as the first time when they finally realized no action was taken after the review. I am waiting for appeal to be heard before I resubmit with prevent backup code in place.
 

Carob

macrumors newbie
Apr 19, 2012
11
0
At least skim the checklist of what to do to release your app. These changes were announced when iOS 5 was released and they continue to be emphasized:
https://developer.apple.com/devcenter/ios/checklist/

They even have "Be sure to read the iOS Data Storage Guidelines to ensure that your app works best with iCloud Backup, available on iOS 5."

The data storage guidelines are short, with a nice summary here:
https://developer.apple.com/icloud/documentation/data-storage/

But definitely read the Q&A here too:
https://developer.apple.com/library/ios/#qa/qa1719/_index.html
 

whooleytoo

macrumors 604
Aug 2, 2002
6,559
628
Cork, Ireland.
Interesting thread, but it's just left me more confused.

My app syncs several documents from our site to the device (for offline viewing, or viewing when data-roaming), but none of the locations Apple mentions seem appropriate.

Documents - I don't need the offline files backed up to iCloud. Apple might reject the app if I use this folder anyway.
Library/Cache - Is cleared in low-storage situations. I can't afford the offline files to be wiped if the user tries to install an app.
Tmp - Not persistant.

For the moment, I'm using a subfolder in Documents, but I wonder if this'll lead to trouble in the review phase.
 

Carob

macrumors newbie
Apr 19, 2012
11
0
My app syncs several documents from our site to the device (for offline viewing, or viewing when data-roaming), but none of the locations Apple mentions seem appropriate.

Documents - I don't need the offline files backed up to iCloud. Apple might reject the app if I use this folder anyway.
Library/Cache - Is cleared in low-storage situations. I can't afford the offline files to be wiped if the user tries to install an app.
Tmp - Not persistant.

For the moment, I'm using a subfolder in Documents, but I wonder if this'll lead to trouble in the review phase.
The Documents folder should get you rejected. You can only store user generated files in the Documents folder.

I don't know, sounds alot like the question in the Q&A I linked to: "My app has a number of files that need to be stored on the device permanently for my app to function properly offline. However, those files do not contain user data and don't need to be backed up. How can I prevent them from being backed up?"

Like the Q&A says, you can use a subfolder of your app's Library folder (like "Application_Support" or "Private Documents") marked with the "do not backup" attribute. You use either NSURLIsExcludedFromBackupKey for iOS 5.1+ or com.apple.MobileBackup for iOS 5.0.1. For iOS 5.0 support, you've got no option but to store in your app's Library/Caches folder, and prepare for those files to potentially be gone when your app's relaunched.
 

whooleytoo

macrumors 604
Aug 2, 2002
6,559
628
Cork, Ireland.
The Documents folder should get you rejected. You can only store user generated files in the Documents folder.

I don't know, sounds alot like the question in the Q&A I linked to: "My app has a number of files that need to be stored on the device permanently for my app to function properly offline. However, those files do not contain user data and don't need to be backed up. How can I prevent them from being backed up?"

Like the Q&A says, you can use a subfolder of your app's Library folder (like "Application_Support" or "Private Documents") marked with the "do not backup" attribute. You use either NSURLIsExcludedFromBackupKey for iOS 5.1+ or com.apple.MobileBackup for iOS 5.0.1. For iOS 5.0 support, you've got no option but to store in your app's Library/Caches folder, and prepare for those files to potentially be gone when your app's relaunched.
Thanks for the response!

Since the offline file storage is a key feature of the app (otherwise we could have just created an iPad-friendly site), Library/Caches isn't an option.

So that leaves us with either not supporting anything below iOS 5.0.1, or using Documents and 'rolling the dice' on the review process. This is part of the reason we wanted to go the Enterprise distribution route, and avoid the App Store review process entirely! :)
 

Carob

macrumors newbie
Apr 19, 2012
11
0
Thanks for the response!

Since the offline file storage is a key feature of the app (otherwise we could have just created an iPad-friendly site), Library/Caches isn't an option.

So that leaves us with either not supporting anything below iOS 5.0.1, or using Documents and 'rolling the dice' on the review process. This is part of the reason we wanted to go the Enterprise distribution route, and avoid the App Store review process entirely! :)
It's been my experience that there are very few people running iOS 5.0 (most are at least 5.0.1), but since we wanted to support iOS 4 we had to support iOS 5.0 and store our files in Caches for that OS only. So, we check for missing files and redownload after launch, and put up a simple error message if the process doesn't complete with a recommendation to upgrade.

Upon upgrading to iOS 5.0.1 or higher we move our files to a library subfolder and use the "do not backup" key/attribute.