ios - 由于文档目录中的数据,应用程序被拒绝

标签 ios objective-c

在启动我的应用程序时,它将库从我的资源文件夹复制到 iOS 设备上的文档目录。这是第一次启动时的一次性过程,再也没有触及过。 Apple 今天拒绝了我的应用程序,原因如下:

We found that your app does not follow the iOS Data Storage Guidelines, which is not in compliance with the App Store Review Guidelines.

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.


我不确定如何设置不备份属性或者它是否是我需要的。谁能告诉我这是如何根据我的代码完成的?

-(void) progress
{
 NSFileManager *fileManager = [NSFileManager defaultManager];
 NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = ([documentPaths count] > 0) ? [documentPaths objectAtIndex:0] : nil;
NSString *dataPath = [documentPath stringByAppendingPathComponent:pathWeSet];

if (![fileManager fileExistsAtPath:dataPath]) {
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSString *dataPath = [bundlePath stringByAppendingPathComponent:pathWeSet];
timer = [NSTimer timerWithTimeInterval:0.4 target:self selector:@selector(updateProgressView) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
[timer fire];
if (dataPath) {
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    [fileManager copyItemAtPath:dataPath toPath:dataPath error:nil];
  });
  }
 }
}

谢谢

最佳答案

Apple 发布 File System Programming Guide您应该阅读并遵循。听起来您的库是用户不应该看到的应用程序的内部细节。因此,它不应该位于 Documents 目录中。考虑使用 Library 或 Library/Caches 目录。

关于ios - 由于文档目录中的数据,应用程序被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18972378/

相关文章:

objective-c - 使用 ARC,如何正确设置具有副作用的属性?

ios - 构建时的段错误代码 11 可能是由 Swift 项目中的 Objective-C Singleton 引起的

iphone - NSUrl 未在 NSUserDefault 中存储为绝对字符串

iphone - 从横向 View Controller 推送时强制纵向方向

ios - xamarin iOS : Location Request how to find out when user clicks “Allow” or “Don' t allow” is clicked

ios - NSNumber转换-对经纬度

objective-c - SMJobSubmit() 能否用于执行由 SMJobBless 安装的特权助手?

ios - '接收器 (<ViewController>) 没有标识符为 'addSegue' 的 segue

ios - Facebook sdk 不从 ios 应用程序发布图片

ios - 如何使用动画笔画绘制矩形