gpt4 book ai didi

ios - 应用程序因文档目录中的数据而被拒绝

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:08:46 25 4
gpt4 key购买 nike

在启动我的应用程序时,它将一个库从我的资源文件夹复制到 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com