2014-10-09 35 views
0

拒绝我没有使用任何的iCloud存储为什么我的应用程序从苹果商店里,虽然我不使用icloud的

理由2.23:应用程序必须遵循的iOS数据存储的准则,否则将被拒绝 ----- 2.23 -----我们发现您的应用不符合iOS数据存储指南,这是每个App Store评论指南所必需的。特别是,我们发现,在发布和/或内容下载时,您的应用商店需要21.12 MB。检查您的应用程序存储的数据量: - 安装并启动您的应用程序 - 转到设置> iCloud > Storage & Backup > Manage Storage - 如有必要,请点击“显示所有应用程序” - 检查您的应用程序的存储iOS数据存储指南指出,只有用户使用创建的内容您的应用程序(例如文档,新文件,编辑等)应由iCloud备份。应用程序使用的临时文件只能存储在/ tmp目录中;请记得在用户退出应用程序时删除存储在此位置的文件。可以重新创建数据但必须持续保持应用程序正常运行的数据 - 或者因为客户希望它可供脱机使用 - 应该标记为“不备份”属性。对于NSURL对象,请添加NSURLIsExcludedFromBackupKey属性以防止备份相应的文件。对于CFURLRef对象,请使用相应的kCFURLIsExcludedFromBackupKey属性。有关更多信息,请参阅技术问答Q & A 1719:如何防止将文件备份到iCloud和iTunes?

要离线存储数据到SQLite的我的作用是

+ (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; 



} 

而下线数据从sqlite的我使用这个功能

+ (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; 
} 
+0

看起来他们是正确的;我没有看到正在设置的排除属性。您是否了解Tech.Q&A 1719页面中的示例代码? – BRFennPocock 2014-10-09 06:50:14

+0

是这一个https://developer.apple.com/library/ios/qa/qa1719/_index.html – 2014-10-09 06:52:04

回答

1

您必须设置一个标志的文件,你别不想在iCloud上同步。默认iOS Sync。如果设备设置允许,则在iCloud上显示应用程序数据。

使用此方法从备份文件跳过

- (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"]]; 
+0

我应该在哪里使用这个功能? – 2014-10-09 06:49:56

+0

在appDidFinishLaunching方法中调用它 – 2014-10-09 06:52:53

+0

NSString * documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)objectAtIndex:0]; [self addSkipBackupAttributeToItemAtURL:[[NSURL alloc] initFileURLWithPath:documentsDirectory]]; – 2014-10-09 09:44:02