【问题标题】:application rejection to the same reason before 2.232.23前同理拒绝申请
【发布时间】:2013-12-18 07:30:27
【问题描述】:

原因

2.23:应用程序必须遵循 iOS 数据存储指南,否则将被拒绝 2.23

我们发现您的应用未遵循 App Store 审核指南所要求的 iOS 数据存储指南。

特别是,我们发现在启动和/或内容下载时,您的应用会存储 64 MB。要检查您的应用存储了多少数据:

  • 安装并启动您的应用
  • 转到设置> iCloud > 存储和备份> 管理存储
  • 如有必要,请点按“显示所有应用”
  • 检查应用的存储空间

iOS 数据存储指南指出,只有用户使用您的应用创建的内容,例如文档、新文件、编辑等,才应由 iCloud 备份。

您的应用程序使用的临时文件应仅存储在 /tmp 目录中;请记住在用户退出应用时删除存储在此位置的文件。

可以重新创建但必须保留以使您的应用正常运行的数据 - 或者因为客户希望它可以离线使用 - 应使用“不备份”属性进行标记。对于 NSURL 对象,添加 NSURLIsExcludedFromBackupKey 属性以防止相应文件被备份。对于 CFURLRef 对象,使用相应的 kCFURLIsExcludedFromBackupKey 属性。

如需更多信息,请参阅技术问答 1719:如何防止文件备份到 iCloud 和 iTunes?。

有必要修改您的应用程序以满足 iOS 数据存储指南的要求。 对于离散代码级别的问题,您可能希望咨询 Apple 开发人员技术支持。请务必:

  • 包括您的拒绝问题的完整详细信息
  • 准备任何符号化的崩溃日志、屏幕截图和步骤,以便在 DTS 工程师跟进时重现问题。

有关如何符号化和读取崩溃日志的信息,请参阅技术说明 TN2151 理解和分析 iPhone OS 应用程序崩溃报告。

如果您在重现此问题时遇到困难,请尝试按照https://developer.apple.com/library/ios/qa/qa1764/Technical Q&A QA1764:如何重现只有 App Review 或用户看到的崩溃或错误中描述的工作流程。 我在 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;
}

.sqlite3 文件没有下载所以我把它放在 /Documents 和其他 pdf 文件和图像被下载 我的申请以同样的理由被拒绝 我是不是忘记了什么??? 请帮帮我

谢谢

【问题讨论】:

  • 他们给你的具体错误信息是什么?他们是否抱怨您在安装时存储的数据不是用户生成的?
  • 您是否在制作 @"/Documents" 不进行备份?在第三个添加SkipBackupAttributeToItemAtURL?将此注释掉并再次提交。
  • r3mus 我编辑了我的问题
  • 我认为不能跳过文档目录。您应该只跳过大文件。
  • Andrea 你对大文件是什么意思

标签: ios objective-c


【解决方案1】:

如果您想提交 iOS 5.0.1 及更高版本,请使用以下代码。我认为您不需要从 iCloud 备份中跳过缓存和 tmp 目录,因为 iCloud 并不关心这些目录。

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

如果可以从服务器下载数据,那么不要将下载的文件保存到 Documents 目录,而是将它们保存到 Cache 目录,该目录是一个临时目录,不会备份到 iCloud,并且可以被随机删除某些场合的操作系统。

【讨论】:

  • 你的意思是我替换这个函数而不是我的函数??
  • 你的意思是这个 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]];
  • 如果您要保存更多文件,您需要确定跳过文档。所以保留这一行:[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathDocuments]];
  • 感谢您的努力,我会再次提交任何方式,我会在收到结果表之前让您的答案正确,希望它工作正常:)
  • mavriks 我做了这个 NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; [self addSkipBackupAttributeToItemAtURL:[[NSURL alloc] initFileURLWithPath:documentsDirectory]];
【解决方案2】:

问题出在这里:

const char* attrName = "com.mycompany.MyApp";

不要用你的 bundle id 改变值,它应该总是:

 const char* attrName = "com.apple.MobileBackup";

【讨论】:

  • 您可以使用@user3097889 解决方案,但请记住,不能将其替换为您的捆绑包ID。
猜你喜欢
  • 2013-05-27
  • 2021-12-11
  • 2017-05-20
  • 2014-01-26
  • 1970-01-01
  • 2014-12-28
  • 1970-01-01
  • 1970-01-01
  • 2022-10-02
相关资源
最近更新 更多