我在 Applestore 中发布了我的应用程序以供审核,但遭到拒绝,上面写着:
” 在启动和内容下载时,您的应用程序会在用户的 iCloud 上存储 1.4 GB,这不符合 iOS 数据存储指南。 "
我在问题末尾粘贴了完整的拒绝文本。
我不知道将数据存储到 ICLoud,我不确定他们如何测试我的应用程序。他们建议查看 ICloud 存储的设置,这是我所做的,但是安装后我看不到我的应用程序使用的任何 ICloud 存储:
在一段时间或设置后,是否有任何自动过程将数据从文档文件夹存储到云端?
通常我的应用是 - 从我的服务器下载一个 zip 文件以存储在我的应用程序的文档文件夹中。 - 然后应用程序也在文档文件夹中解压缩 zip 文件。
当使用 IOS-Simulator 进行测试时,我可以使用 shell 检查文档文件夹的内容,并且内容就在那里。 (而不是在 ICloud 上)
谁能帮助我,开发人员在这种情况下必须做什么。
我在这里粘贴了相关代码,它显示了我如何下载内容以及如何解压缩内容。
class ViewController: UIViewController, NSURLSessionDelegate {
let sDataPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString as String; ///var/mobile/Containers/Data/Application/8897ED62-5BAE-4255-8459-F0F8381C171F/Documents/
download_file(sfrom,sToLocation: sDataPath);
func download_file(sURL: String, sToLocation: String) {
print("start downloading ...");
print("sURL : " + sURL + " sToLocation : " + sToLocation);
bytesDownloaded=0;
let downloadsessiondelegate = self;
downloadsessiondelegate.storePath=sToLocation;
downloadsessiondelegate.progressView=progressView;
downloadsessiondelegate.surl=sURL;
struct SessionProperties {
static let identifier : String! = "url_session_background_download"
}
let date = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components([.Hour, .Minute], fromDate: date)
let hour = String(components.hour)
let minutes = String(components.minute)
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier("session_" + hour + minutes)
let backgroundSession = NSURLSession(configuration: configuration, delegate: downloadsessiondelegate, delegateQueue: nil)
//myURLSession = NSURLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
let url = NSURLRequest(URL: NSURL(string: sURL)!)
//var downloadTask = backgroundSession.downloadTaskWithRequest(url)
let downloadTask = backgroundSession.downloadTaskWithRequest(url)
downloadTask.resume()
}
func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location1: NSURL) {
//println("session \(session) has finished the download task \(downloadTask) of URL \(location1).")
// remove Session ID
//defaults.removeObjectForKey(<#defaultName: String#>)
let defaults = NSUserDefaults.standardUserDefaults()
defaults.removeObjectForKey("SessionProperties_identifier" + "_" + surl)
var error: NSError?
let target=storePath;
var source : String = location1.absoluteString;
let filemgr = NSFileManager.defaultManager();
let modifiedsource = source.stringByReplacingOccurrencesOfString("file://", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
if (filemgr.fileExistsAtPath(target))
{
do {
try filemgr.removeItemAtPath(target)
} catch let error1 as NSError {
error = error1
}
//println("FILE AVAILABLE");
}
do {
try filemgr.moveItemAtPath(modifiedsource, toPath: target)
dispatch_async(dispatch_get_main_queue(),{
self.progressView.setProgress(0, animated: false);
//progressView.removeFromSuperview();
print("Move successful")
self.install_content();
})
//download_file_finished();
} catch var error1 as NSError {
error = error1
print("Moved failed with error: \(error!.localizedDescription)")
install_failed("Moved failed with error: \(error!.localizedDescription)");
}
}
func unzipFile(sZipFile: String, toDest: String, estimatedByte:Int){
SSZipArchive.unzipFileAtPath(sZipFile, toDestination: toDest, progressHandler: {
(entry, zipInfo, readByte, totalByte) -> Void in
//let itotalByte=totalByte;
let stufe=4096*1000;
if totalByte % stufe == 0 {
//println("readByte : \(totalByte)")
}
dispatch_async(dispatch_get_main_queue()) {
var percent:Float=Float(Float(totalByte)/Float(estimatedByte));
if percent>1.0{
percent=1.0;
}
let percent_int=Int(percent*100);
let percenttext:String=String(percent_int);
self.progressView.setProgress(percent, animated: false);
let sMessage=self.actualinstalldefinition.title;
let messagewithprozent=sMessage + " (" + percenttext + "%)";
self.progress_label_Titel.text = messagewithprozent;
if percent_int % 20 == 0 && self.lastpercent != percent_int{
let progressimage=self.get_random_progress_image();
self.progressImageView.image = progressimage;
self.lastpercent=percent_int;
}
}
}, completionHandler: { (path, success, error) -> Void in
if success {
// Loesche das ZipFile
let fileManager = NSFileManager.defaultManager()
var error: NSError?
if (fileManager.fileExistsAtPath(sZipFile)){
do {
try fileManager.removeItemAtPath(sZipFile)
} catch let error1 as NSError {
error = error1
} catch {
fatalError()
}
}
dispatch_async(dispatch_get_main_queue(),{
self.progressView.setProgress(0, animated: false);
//progressView.removeFromSuperview();
print("Move successful")
self.install_content();
})
} else {
//progressBar?.hidden = true
self.install_failed(error.localizedDescription);
print(error)
}
})
}
完整的拒绝声明:
2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected
2.23 细节
在启动和内容下载时,您的应用会在用户的 iCloud 上存储 1.4 GB,这不符合 iOS 数据存储指南。
后续步骤
请确认只有用户使用您的应用程序创建的内容(例如文档、新文件、编辑等)根据 iOS 数据存储指南的要求由 iCloud 备份。此外,检查您的应用程序使用的任何临时文件是否仅存储在/tmp 目录中;请记得在确定不再需要时移除或删除存储在此位置的文件。
可以重新创建但必须保留以确保您的应用程序正常运行的数据 - 或者因为用户希望它可以离线使用 - 应该标有“不备份”属性。对于 NSURL 对象,添加 NSURLIsExcludedFromBackupKey 属性,防止对应文件被备份。对于 CFURLRef 对象,使用相应的 kCRUFLIsExcludedFromBackupKey 属性。
资源
检查您的应用存储了多少数据:
- Install and launch your app
- Go to Settings > iCloud > Storage > Manage Storage
- Select your device
- If necessary, tap "Show all apps"
- Check your app's storage
有关防止文件备份到 iCloud 和 iTunes 的更多信息,请参阅技术问答 1719:如何防止文件备份到 iCloud 和 iTunes。
如果您难以重现报告的问题,请尝试测试技术问答 QA1764 中描述的工作流程:如何重现针对 App Store 提交报告的错误。
如果您在使用上述资源后遇到代码级问题,您可能希望咨询 Apple 开发人员技术支持。当 DTS 工程师跟进您时,请准备好提供: - 拒绝问题的完整细节 - 截图 - 重现问题的步骤 - 符号化的崩溃日志 - 如果您的问题导致崩溃日志
最佳答案
Documents 文件夹中的文件会自动备份到 iCloud。
备份过程可能不会立即开始,这就是您看不到应用的 iCloud 存储空间的原因。
使用此代码从自动备份中排除文件。
try! filePath.setResourceValue(true, forKey: NSURLIsExcludedFromBackupKey)
参见 docs获取更多信息。
关于ios - 应用程序使用的 iCloud 存储空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35501100/