Reputation: 121
Reasons
2.23: Apps must follow the iOS Data Storage Guidelines or they will be rejected 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 64 MB. To check how much data your app is storing:
The 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?.
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:
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/Technical Q&A QA1764: How to reproduce a crash or bug that only App Review or users are seeing. and i set this function in AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSString *pathCaches = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
NSString *pathTmp = [NSHomeDirectory() stringByAppendingPathComponent:@"/tmp"];
NSString *pathDocuments = [NSHomeDirectory() stringByAppendingPathComponent:@"/Documents"];
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathCaches]];
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathTmp]];
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathDocuments]];
return YES;
}
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
assert([[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]);
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.mycompany.MyApp";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}
The .sqlite3 file is not downloaded so I putted it in /Documents and other pdf files and images are downloaded and my application rejected with the same reason Is i forget something ??? Please help me
Thank You
Upvotes: 1
Views: 658
Reputation: 524
In case you want to submit for iOS versions 5.0.1 and above, use the below code. I don't think that you need to skip cache and tmp directory from iCloud backup coz iCloud doesn't care about these directories.
+(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)fileURL {
// First ensure the file actually exists
if (![[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) {
NSLog(@"File %@ doesn't exist!",[fileURL path]);
return NO;
}
// Determine the iOS version to choose correct skipBackup method
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer isEqualToString:@"5.0.1"]) {
const char* filePath = [[fileURL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
NSLog(@"Excluded '%@' from backup",fileURL);
return result == 0;
}
else if (&NSURLIsExcludedFromBackupKey) {
NSError *error = nil;
BOOL result = [fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
if (result == NO) {
NSLog(@"Error excluding '%@' from backup. Error: %@",fileURL, error);
return NO;
}
else { // Succeeded
NSLog(@"Excluded '%@' from backup",fileURL);
return YES;
}
} else {
// iOS version is below 5.0, no need to do anything
return YES;
}
}
If the data can be downloadable from Server,then instead of saving your downloaded files to the Documents directory save them to the Cache directory which is a temp directory that don't get backed up to iCloud and can be randomly deleted by the OS on certain occasions.
Upvotes: 2
Reputation: 1919
The problem is here:
const char* attrName = "com.mycompany.MyApp";
Dont change the value with your bundle id, it should always be:
const char* attrName = "com.apple.MobileBackup";
Upvotes: 0