由于未遵循iOS应用数据存储指南,我的应用被拒绝了 [英] My app got rejected due to not following iOS App Data Storage Guidelines

查看:155
本文介绍了由于未遵循iOS应用数据存储指南,我的应用被拒绝了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于未遵循iOS应用数据存储指南,我的应用遭到拒绝。
我的二进制文件被Apple App Store评论小组拒绝。

My app got rejected due to not follow iOS App Data Storage Guidelines. My binary was rejected by the Apple App Store Review Team.


在启动和内容下载时,您的应用程序存储6.34MB用户的iCloud,不符合iOS数据存储指南。

On launch and content download, your app stores 6.34MB on the user's iCloud, which does not comply with the iOS Data Storage Guidelines.

后续步骤

请验证根据iOS数据存储指南的要求,iCloud仅支持用户使用您的应用创建的内容,例如文档,新文件,编辑等。另外,检查应用程序使用的任何临时文件是否只存储在/ tmp目录中;请记住在确定不再需要这些文件时删除或删除存储在此位置的文件。

Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed.

可以重新创建但必须保持正常运行的数据应用程序 - 或者因为用户希望它可供脱机使用 - 应标记为不备份属性。对于NSURL对象,请添加NSURLIsExcludedFromBackupKey属性以防止备份相应的文件。对于CFURLRef对象,请使用相应的kCRUFLIsExcludedFromBackupKey属性。

Data that can be recreated but must persist for proper functioning of your app - or because users 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 kCRUFLIsExcludedFromBackupKey attribute.

我该怎么办?

推荐答案

iOS数据存储指南快速指南



很多人都遇到了这个问题,通常看来审核小组自动声明您的应用不符合iOS存储指南。无论哪种方式,您都需要记录您的应用程序存储数据的位置以及存储在哪里的数据。这是一个快速指南,可以帮助您入门。

iOS Data Storage Guidelines quick guide

A lot of people are having this problem and often it seems that the review team is automatically claiming that your app does not follow the iOS Storage Guidelines. Either way you need to document where your app store data and what data is stored where. Here's a quick guide that should get you started.

您的应用可以将文件存储在/ Documents,/ Library或/ tmp中。

Your app can store files in either /Documents, /Library or /tmp.

文件/


使用此目录存储用户生成的内容。该目录的内容可以通过文件共享提供给用户;因此,他的目录应该只包含您可能希望向用户公开的文件。
此目录的内容由iTunes备份。

Use this directory to store user-generated content. The contents of this directory can be made available to the user through file sharing; therefore, his directory should only contain files that you may wish to expose to the user. The contents of this directory are backed up by iTunes.

图书馆/


这是非用户数据文件的任何文件的顶级目录。您通常将文件放在几个标准子目录之一中。 iOS应用程序通常使用Application Support和Caches子目录;但是,您可以创建自定义子目录。
对于您不希望向用户公开的任何文件,请使用Library子目录。您的应用不应将这些目录用于用户数据文件。
Library目录的内容(Caches子目录除外)由iTunes备份。

This is the top-level directory for any files that are not user data files. You typically put files in one of several standard subdirectories. iOS apps commonly use the Application Support and Caches subdirectories; however, you can create custom subdirectories. Use the Library subdirectories for any files you don’t want exposed to the user. Your app should not use these directories for user data files. The contents of the Library directory (with the exception of the Caches subdirectory) are backed up by iTunes.

tmp /


使用此目录编写在应用程序启动之间不需要保留的临时文件。您的应用程序应在不再需要时删除此目录中的文件;但是,当您的应用未运行时,系统可能会清除此目录。
此目录的内容不会被iTunes备份。

Use this directory to write temporary files that do not need to persist between launches of your app. Your app should remove files from this directory when they are no longer needed; however, the system may purge this directory when your app is not running. The contents of this directory are not backed up by iTunes.








将用户数据放入Documents /.
这是由iTunes / iCloud备份

将应用程序创建的支持文件放入库/应用程序支持/
这是由iTunes / iCloud备份

将临时数据放入tmp /目录。
iTunes / iCloud不支持

但如何找出我的文件存储位置?

将脚本放在你的appDelegate文件中的func应用程序:didFinishLaunchingWithOptions中。 NSSearchPathDirectory是一个枚举,代表不同的文件夹/位置。其中一些是这些。

Put the script bellow in func application:didFinishLaunchingWithOptions in your appDelegate file. NSSearchPathDirectory is an enum and represents different folder/locations. Some of them are these.

public enum NSSearchPathDirectory : UInt {
case DocumentDirectory 
case LibraryDirectory

}

将NSSearhPathDirectory(.DocumentDirectory)更改为所需位置并检查哪些文件你在那里存储。

Change the NSSearhPathDirectory(.DocumentDirectory) to desired locations and check what files you are storing there.

let paths: NSArray = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true)
    if let documentDirectory = paths.firstObject{
        do{
            let documents = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(documentDirectory as! String)

            for files in documents {
                let urlForm = NSURL.fileURLWithPath((documentDirectory as! String) + "/" + files)

                do{
                    try print("\(files): \(urlForm.resourceValuesForKeys([NSURLIsExcludedFromBackupKey])), with filepath: \(urlForm)")
                 //Prints out folder and files in the desired location

                } catch let error as NSError{
                    print("Can't find key: \(error)")
                }

            }

        }catch let error as NSError{
            print("Can't retrieve contents: \(error)")
        }
    }






我的应用不保存任何内容

幸运的是...将文档写入Apple审核小组并记录您的应用使用存储。从上面脚本中的日志中截取屏幕截图。

Lucky you...Write a document to the Apple review team and document your app use of storage. Take screenshots from the logs made out from the script above.

我的应用程序保存了大量用户创建的数据

如果您的应用将用户的数据保存到Documents /那很好,并写一份文档,记录这是由用户做出的,并遵循iOS数据存储指南。

If your app saves a user's data to Documents/ that is fine and write a document documenting that this is made by the user and do follow the iOS Data Storage Guidelines.

如果您的应用下载数据并将其保存到错误的位置

只需按照iOS数据存储指南并提交新的二进制文件。

Simply follow the iOS Data Storage Guidelines and submit a new binary.

我有Documents /或Library /中的文件,但我不想备份它们


从iOS 5.1开始,应用程序可以使用NSURLIsExcludedFromBackupKey或kCFURLIsExcludedFromBackupKey文件系统属性从备份中排除文件和目录。需要排除大量文件的应用可以通过创建自己的子目录并将该目录标记为已排除来排除它们。应用程序应创建自己的排除目录,而不是排除系统定义的目录。与直接设置扩展属性的旧的,不推荐使用的方法相比,这两种API都是首选。在iOS 5.1及更高版本上运行的所有应用都应使用这些API从备份中排除数据。

Starting in iOS 5.1, apps can use either NSURLIsExcludedFromBackupKey or kCFURLIsExcludedFromBackupKey file system properties to exclude files and directories from backups. Apps that need to exclude a large number of files can exclude them by creating their own sub-directory and marking that directory as excluded. Apps should create their own directories for exclusion, rather than excluding the system defined directories. Either of these APIs is preferred over the older, deprecated approach of directly setting an extended attribute. All apps running on iOS 5.1 and later should use these APIs to exclude data from backups.

我创建了一个快速脚本来处理您不想备份的文件。

I've created a quick script to handle files that you don't want to backup.

func addSkipBackupAttributeToItemAtPath(filepath: String)-> Bool {

if let url: NSURL = NSURL(fileURLWithPath: filepath) {
    let exist = NSFileManager.defaultManager().fileExistsAtPath(String(url))

    if exist{
        do
        {
            try url.setResourceValues(["YES" : "NSURLIsExcludedFromBackupKey"])
            return true
        }
        catch let error as NSError
        {
            print("\(error)")
            return false

        }

    } else
    {
        print("File does not exist")
        return false
    }

} else
{
    print("Path not recognized")
    return false
}
}






如果您认为自己的应用被拒绝,请写回审核小组并解释情况和您对存储的使用

简单指南


带宽,网络ava可用性和存储是有限的资源,对您的用户有实际的财务影响。在设计架构时,只在iCloud中存储无法重新创建的信息。

Bandwidth, network availability, and storage are limited resources and have real, financial consequences for your users. When you design your schema, store in iCloud only information that can’t be re-created.

启用iCloud的核心数据应用程序不仅可以识别在设备,他们知道其他设备上的数据。在设计Core Data堆栈时记住这一事实是个好主意。

iCloud-enabled Core Data apps are not only aware of data created on the device, they’re aware of data on other devices. It’s a good idea to keep this fact in mind when designing your Core Data stack.

当您保存托管对象上下文时,Core Data会在普遍容器中创建一个保证在其他对等方上一起应用的事务更改集。此交易集的大小以及保存上下文的频率都会直接影响应用的效果。

When you save a managed object context, Core Data creates, in the ubiquity container, a set of transaction changes that are guaranteed to be applied together on other peers. The size of this transaction set, and the frequency with which you save your context, both directly impact the performance of your app.






资源:


Resources:

iOS数据存储指南 - Apple开发人员

iCloud核心数据编程指南

文件系统编程指南

这篇关于由于未遵循iOS应用数据存储指南,我的应用被拒绝了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆