Dopo aver inviato l’ultima App IOS per la revisione, Apple ha rifiutato la richiesta e mi ha risposto con:
|
1 2 3 4 5 6 7 8 9 10 11 |
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 5.48 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 storage ....... |
La segnalazione è chiara, così come è chiaro l’errore che ho commesso.
Sbadatamente ho copiato il DB sqlite dell’app nella cartella Documenti (NSDocumentDirector), senza indicare che il DB non doveva essere salvato su iCloud. Bisogna infatti ricordare che su iCloud vanno salvati solo i dati utente e non il database interno dell’app.
Le soluzioni sono due:
1 – nel caso di dati temporanei da cancellare a fine applicazione, si può salvare nella cartella dei temporani (NSCachesDirectory)
2 – salvare il file nella cartella dei documenti, ma escluderlo dal salvataggio su iCloud impostando l’attributo NSURLIsExcludedFromBackupKey oppure l’attributo kCFURLIsExcludedFromBackupKey. Potete utilizzare il seguente metodo:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include < sys/xattr.h > + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { if (&NSURLIsExcludedFromBackupKey == nil) { // iOS <= 5.0.1 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; } else { // iOS >= 5.1 NSError *error = nil; [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error]; return error == nil; } } |
e poi richiamarlo come segue:
|
1 2 3 4 5 6 7 8 |
+(void) checkAndCreateDatabase{ NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; NSString *dbPath = [documentsDir stringByAppendingPathComponent:dbName]; NSURL *skipURL =[NSURL fileURLWithPath:dbPath]; [self addSkipBackupAttributeToItemAtURL:skipURL]; } |
enjoy!
Ti interessa acquistare un dominio a prezzi ultraconvenienti? clicca qui
Se hai trovato utili le informazioni su questo blog,
Fai una donazione!
Clicca sul bottone qui sotto o almeno clicca sul banner pubblicitario 🙂
Commenta