Don't Understand App Rejection

Discussion in 'iOS Programming' started by newtoiphonesdk, May 25, 2012.

  1. newtoiphonesdk, May 25, 2012
    Last edited by a moderator: May 25, 2012

    newtoiphonesdk macrumors 6502a

    Joined:
    Jul 30, 2010
    #1
    I got this app rejected today, and the following was in the Resolution Center:

    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?
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #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
     
  3. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #3
    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.
     
  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    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.
     
  5. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #5

    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.
     
  6. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #6
    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?
     
  7. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #7
    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.
     
  8. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #8
    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.
     
  9. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #9
    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
     
  10. newtoiphonesdk, Jun 2, 2012
    Last edited: Jun 2, 2012

    newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #10
    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;
    }
        
    }
    
    
     
  11. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #11
    Normally NSLibrary doesn't get automatically backupped.. i'm a tad confused now. My apologies.
     
  12. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #12
    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.
     
  13. Carob macrumors newbie

    Joined:
    Apr 19, 2012
    #13
    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
     
  14. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #14
    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.
     
  15. Carob macrumors newbie

    Joined:
    Apr 19, 2012
    #15
    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.
     
  16. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #16
    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! :)
     
  17. Carob macrumors newbie

    Joined:
    Apr 19, 2012
    #17
    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.
     

Share This Page