gpt4 book ai didi

ios - 我的应用因未遵循 iOS 应用数据存储指南而被拒绝

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

我的应用因未遵循 iOS 应用数据存储指南而被拒绝。我的二进制文件被 Apple App Store 审查小组拒绝了。

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.

Next Steps

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.

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 存储指南。无论哪种方式,您都需要记录您的应用程序存储数据的位置以及哪些数据存储在何处。这是一份可以帮助您入门的快速指南。

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

iOS File System Storage

文档/

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.

图书馆/

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/

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.


Put user data in Documents/. This is backed up by iTunes/iCloud

Put app-created support files in the Library/Application support/ This is backed up by iTunes/iCloud

Put temporary data in the tmp/ directory. This is not backed up by iTunes/iCloud

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

将下面的脚本放在您的 appDelegate 文件中的 func application:didFinishLaunchingWithOptions 中。 NSSearchPathDirectory 是一个枚举,代表不同的文件夹/位置。其中一些是这些。

public enum NSSearchPathDirectory : UInt {
case DocumentDirectory
case LibraryDirectory

}

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

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 审核团队写一份文档,记录您的应用程序对存储的使用情况。从上述脚本生成的日志中截取屏幕截图。

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

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

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

只需遵循 iOS 数据存储指南并提交新的二进制文件即可。


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

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.

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

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
}
}

如果您认为您的应用被拒绝是错误的,请给审核团队回信并解释情况和您对存储的使用


简单的指南

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-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.

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.


资源:

iOS Data Storage Guidelines - Apple Developer

iCloud Programming Guide for Core Data

File System Programming Guide

关于ios - 我的应用因未遵循 iOS 应用数据存储指南而被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37331529/

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