why my app is rejected from appstore although i am not using icloud

大城市里の小女人 提交于 2020-01-03 05:34:13

问题


I did not use any icloud storage

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 21.12 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

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?.


To Store data offline into Sqlite my function is

+ (NSString*)saveImageInDocuments:(UIImage*)senderImage {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSDate *selected = [NSDate date];

    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"ddmmyyyyhhmmss"];
    NSString *imgName = [dateFormat stringFromDate:selected];

    imgName = [NSString stringWithFormat:@"%@.jpg",imgName];

    NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:imgName];

    UIImage *image = senderImage;
    NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
    [imageData writeToFile:savedImagePath atomically:YES];
     NSLog(@"path is... %@",savedImagePath);
    return imgName;



}

And to get data offline from sqlite i am using this function

+ (UIImage*)getImageFromDocuments:(NSString*)senderImageName {

    NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:senderImageName];

    NSFileManager *fileManager = [NSFileManager defaultManager];
    BOOL fileExist = [fileManager fileExistsAtPath:getImagePath]; // Returns a BOOL

    UIImage *img = [[UIImage alloc] init];
    if(fileExist)
    {
        img = [[UIImage alloc] init];
        img = [UIImage imageWithContentsOfFile:getImagePath];
    }
    NSLog(@"path is... %@",getImagePath);
    return img;
}

回答1:


You have to set a flags for files which you don't want to sync on iCloud. By default iOS Sync. app data on iCloud if device settings allow it.

Use this method to skip files from backup

- (BOOL)addSkipBackupAttributeToItemAtURL: (NSURL *)URL {

    float version = [[[UIDevice currentDevice] systemVersion] floatValue];
    if (version > 5.0) {
        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;
    }
    return NO;
}
[self addSkipBackupAttributeToItemAtURL:[[NSURL alloc] initFileURLWithPath:"YOURFILEPATH"]];


来源:https://stackoverflow.com/questions/26271909/why-my-app-is-rejected-from-appstore-although-i-am-not-using-icloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!