Reject wegen iOS Data Storage Guidelines

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Reject wegen iOS Data Storage Guidelines

    Meine App wurde nicht zugelassen wegen Daten für den iCloud Backup.

    Genauer heißt es:
    ​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 4.04 MB. 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 storageThe iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be 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?.


    So gut dachte ich mir, dann machste halt folgendes:

    Quellcode

    1. ​-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)fileURL {
    2. if (![[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) {
    3. NSLog(@"File %@ doesn't exist!",[fileURL path]);
    4. return NO;
    5. }
    6. NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
    7. if ([currSysVer isEqualToString:@"5.0.1"]) {
    8. const char* filePath = [[fileURL path] fileSystemRepresentation];
    9. const char* attrName = "com.apple.MobileBackup";
    10. u_int8_t attrValue = 1;
    11. int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
    12. NSLog(@"Excluded '%@' from backup",fileURL);
    13. return result == 0;
    14. }
    15. else if (&NSURLIsExcludedFromBackupKey) { //iOS 5.1 and later
    16. NSError *error = nil;
    17. BOOL result = [fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
    18. if (result == NO) {
    19. NSLog(@"Error excluding '%@' from backup. Error: %@",fileURL, error);
    20. return NO;
    21. }
    22. else { // Succeeded
    23. NSLog(@"Excluded '%@' from backup",fileURL);
    24. return YES;
    25. }
    26. } else {
    27. // iOS version is below 5.0, no need to do anything because there will be no iCloud present
    28. return YES;
    29. }
    30. }
    31. // now call above method from where you are storing your files/folders in NSDocumnetsDirectory
    32. -(BOOL) doNotBackUpMyFolderOrFile {
    33. NSString *applicationCacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,
    34. NSUserDomainMask,
    35. YES) lastObject];
    36. NSURL *pathURL= [NSURL fileURLWithPath: applicationCacheDir isDirectory:YES];
    37. NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
    38. NSURL *documentsURL = [paths lastObject];
    39. NSURL *tmpURL = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES];
    40. if ([self addSkipBackupAttributeToItemAtURL:documentsURL] &&
    41. [self addSkipBackupAttributeToItemAtURL:pathURL] &&
    42. [self addSkipBackupAttributeToItemAtURL:tmpURL] ) {
    43. return YES;
    44. }
    45. return NO;
    46. }
    Alles anzeigen


    Quellcode

    1. [self doNotBackUpMyFolderOrFile]
    wird in

    Quellcode

    1. -application:didFinishLaunchingWithOptions:
    aufgerufen.

    Auf dem Mac navigiere ich per Terminal zu

    /Library/Application Support/iPhone Simulator/7.1/Applications/9224585D-9B05-44E5-8A84-1AEFB56E4579

    und gebe

    Quellcode

    1. ls -al -@
    ein:

    Das Ergebnis lautet:

    Quellcode

    1. ​total 176
    2. drwxr-xr-x@ 8 user staff 272 Jul 8 16:18 .
    3. com.apple.installd.container_bundle_id 35
    4. com.apple.installd.container_creation_os_build 7
    5. drwxr-xr-x 13 user staff 442 Jul 8 17:42 ..
    6. -rw-r--r--@ 1 user staff 6148 Jul 8 16:53 .DS_Store
    7. com.apple.FinderInfo 32
    8. drwxr-xr-x@ 7 user staff 238 Jun 17 13:03 Documents
    9. com.apple.metadata:com_apple_backup_excludeItem 22
    10. drwxr-xr-x 6 user staff 204 Jul 8 16:53 Library
    11. drwxr-xr-x 59 user staff 2006 Jul 8 16:24 APPNAME.app
    12. -rw-r--r-- 1 user staff 80109 Jun 17 11:24 iTunesArtwork
    13. drwxr-xr-x 2 user staff 68 Jul 8 16:22 tmp
    Alles anzeigen


    Wenn ich das richtig verstehe dann steht da:

    Quellcode

    1. ​So there is Documents com.apple.metadata:com_apple_backup_excludeItem


    Ich spiele die App neu aufs iPad. iCloud Backup ist aktiviert. iOS 7.1.2, iPad Air.

    Ich navigiere zu Settings > iCloud > Storage & Backup > Manage Storage > My iPad > Show All Apps Und meine App taucht mit 4.2 MB auf.

    Die App ist unter Settings > General > Usage > Show all Apps My App 11 MB groß.


    Kommt nun meine App durch den Review Prozess? Hab ich was falsch gemacht? Gibt es einen anderen Weg? Nach dem installieren per Xcode tauchen diese blöden 4.2 MB auf und ich weiß nicht wieso :/

    CouchDB und Piwik kommen als "spezielle" Extras in der App vor, sonst ist alles von mir. ?(
  • Normalerweise gibt es diesen Reject wenn man z.B. aus dem Netz geladene Daten ins DocumentDir schreibt. Da haben die nichts verloren, da sie jederzeit über das Netz auch wieder hergestellt werden können. Deshalb sollen die ins CachedDir, wo sie auch nicht sofort gelöscht weden sondern erst wenn der Platz auf dem Device eng wird.
    DAs gleiche gilt für alle Daten die nicht nur lokal auf dem Device gehalten werden. Werden also die Daten die der User in der App erstellt nicht nur dort gespeichert sondern auch zu irgendwelchen Servern geschickt, dann bist du und der Server dafür verantwortlich und nicht mehr die Cloud. Ergo haben diese Datein nichts im DocumentDir verloren, da du die Möglichkeit in deiner App implementieren must, die gesendeten Daten auch jederzeit wieder empfangen und so wieder herstellen zu können.

    Gruß

    Claus
    2 Stunden Try & Error erspart 10 Minuten Handbuchlesen.

    Pre-Kaffee-Posts sind mit Vorsicht zu geniessen :)