- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我的应用程序第二次被拒绝,我浪费了 3 周 :(
第一次提交时,我只排除了目录在 iCloud 中的备份。苹果拒绝...
第二次提交时,我将下载的目录和图片排除在 iCloud 中的备份之外。 Apple 再次拒绝...Apple 还提示我的应用内购买没有“恢复”功能,而事实上,我确实有一个“恢复”按钮,并且在我测试时它有效。
我已经按照 Apple 的建议完成了,使用 NSURLIsExcludedFromBackupKey 将文件排除在备份之外。 Macmade 在 stackoverflow here 上发表了一条有趣的评论:
sometimes Apple reviewers think your data can be re-generated, when it's not. Then you'll have to explain why the data has to be backed-up
审稿人误解的频率有多少,我们必须向他们解释内容需要离线且不可重新生成?
这是我用来从 iCloud 中排除我的文件和目录的代码。你发现任何问题了吗?
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
// There's a chance the download failed, but don't assert here
//assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
NSError *error = nil;
BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKey
error: &error];
if(!success){
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
}
return success;
}
//Download picture from Google and exclude it from being backed-up in iCloud
- (void)downloadFetcher:(GTMHTTPFetcher *)fetcher
finishedWithData:(NSData *)data
error:(NSError *)error
{
if (error == nil) {
// successfully retrieved this photo's data; save it to disk
GDataEntryPhoto *photoEntry = [fetcher propertyForKey:@"photo entry"];
// Create album directory if it doesn't already exist
NSString *path = [self findOrCreateApplicationSupportSubPath:[photoEntry albumTitle]];
path = [path stringByAppendingPathComponent:[[photoEntry title] stringValue]];
if (path != nil) {
// Write to disk
BOOL didSave = [data writeToFile:path
options:NSDataWritingAtomic
error:&error];
if (didSave) {
// Exclude file from being backed up in iCloud
NSURL *url = [NSURL fileURLWithPath:path];
BOOL excludeBackupResult = [self addSkipBackupAttributeToItemAtURL:url];
if (excludeBackupResult == NO) {
NSLog(@"Error excluding FILE from iCloud: %@", path);
}
// Update the download progress bar
_downloadedFileCounter = _downloadedFileCounter + 1;
float progress = _downloadedFileCounter / kMaleWireframeImagesTotal;
[self updateProgress:progress];
// The download completed. -2 just incase a package is lost, but let the user move on...
if (_downloadedFileCounter >= _downloadableFilesTotal -2) {
[_panel6 downloadCompleted];
}
} else {
// error saving file. Perhaps out of space? Write permissions error?
NSLog(@"Save anatomy picture failed: %@", error.localizedDescription);
}
} else {
NSLog(@"downloadFetcher: Cannot create directory");
}
} else {
NSLog(@"downloadFetcher failed: %@", error);
}
}
//Create directory and exclude it from being backed-up in iCloud
-(NSString*)findOrCreateApplicationSupportSubPath:(NSString*)subPath
{
NSString *resolvedPath;
NSArray *appSupportDir = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([appSupportDir count] != 0) {
resolvedPath = [appSupportDir objectAtIndex:0];
// Append the name of this application
NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"];
resolvedPath = [resolvedPath stringByAppendingPathComponent:executableName];
resolvedPath = [resolvedPath stringByAppendingPathComponent:subPath];
NSFileManager *manager = [NSFileManager defaultManager];
if (![manager fileExistsAtPath:resolvedPath]) {
// Path doesn't exist, creates it
NSError *error;
BOOL successful = [manager createDirectoryAtPath:resolvedPath withIntermediateDirectories:YES attributes:nil error:&error];
if(!successful) {
NSLog(@"ERROR creating APP Support Sub-Directory: %@", error.localizedDescription);
return nil;
} else {
// Exclude path from backing-up in iCloud
NSURL *url = [NSURL fileURLWithPath:resolvedPath];
BOOL excludeBackupResult = [self addSkipBackupAttributeToItemAtURL:url];
if(!excludeBackupResult){
NSLog(@"Error excluding DIRECTORY from iCloud backup. This is a violation to their guideline.");
return nil;
}
}
}
} else {
NSLog(@"No Application Support Path available");
return nil;
}
return resolvedPath;
}
最佳答案
我认为诀窍是添加 NSURLIsExcludedFromBackupKey 或确保该目录在文档目录之外。我通过将我的文档移动到 Library/Application Support 文件夹来做到这一点(因为它在/tmp 或/Caches 文件夹中没有意义):
- (void)createNewRefFolder
{
NSError *error;
// store in /Library/Application Support/BUNDLE_IDENTIFIER/Reference
// make sure Application Support folder exists
NSURL *applicationSupportDirectory = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory
inDomain:NSUserDomainMask
appropriateForURL:nil
create:YES
error:&error];
if (error) {
NSLog(@"KCDM: Could not create application support directory. %@", error);
}
NSURL *referenceFolder = [applicationSupportDirectory URLByAppendingPathComponent:@"Reference" isDirectory:YES];
if (![[NSFileManager defaultManager] createDirectoryAtPath:[referenceFolder path]
withIntermediateDirectories:YES
attributes:nil
error:&error]) {
NSLog(@"KCDM: Error creating Reference folder: %@ ...", error);
}
BOOL success = [referenceFolder setResourceValue:@YES forKey: NSURLIsExcludedFromBackupKey error: &error];
if(!success){
NSLog(@"KCDM: Error excluding %@ from backup %@", referenceFolder, error);
}
}
关于ios - 从 iCloud 备份中排除 : NSURLIsExcludedFromBackupKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25517489/
如何启用 Mercurial(中央/主)存储库的自动(增量)备份? 我来自颠覆,在那里我能够制作一个提交 Hook ,将更改上传到 S3。 编辑: 如果这种策略对 Mercurial 没有意义,那么什
我想定期创建我的github存储库的备份。是否有一种快速的方法可以在不知道整个列表的情况下将它们全部拉出? 沃尔特 最佳答案 您可以通过GitHub的API获取整个列表: curl http://gi
我正在使用 flatpages在我在本地服务器上开发的站点中。我需要备份平面页面的数据以在最终服务器中使用它。有谁知道怎么做? 最佳答案 在您的本地服务器上运行: python manage.py d
我们已将应用服务升级到 S1,并希望设置自动备份。这是一个带有 SQL 数据库的 .net core 应用程序。对于数据库部分,我得到以下内容: No supported connection str
我们使用一些 阻止 blob 来存储一些持久资源,然后 用于存储事件数据的页面 blob 我们需要备份 blob,因此我尝试使用 AzCopy。它在我的开发机器上工作正常,但在其他慢速机器上失败,并出
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 5年前关闭。 Improve this questi
我正在看这个例子 docker run --rm --volumes-from myredis -v $(pwd)/backup:/backup debian cp /data/dump.rdb /b
我们使用一些 阻止 blob 来存储一些持久资源,然后 用于存储事件数据的页面 blob 我们需要备份 blob,因此我尝试使用 AzCopy。它在我的开发机器上工作正常,但在其他慢速机器上失败,并出
我目前正在使用 Java,并且正在寻找一个程序,该程序可以在每次编译时保存我正在执行的操作的新版本。我不介意它是否不运行,我可以进去编辑类名,使其与 .java 名称匹配。由于我是一个初学者,我总是因
在 RabbitMQ 管理控制台中,出于导入和导出目的,我在概览页面底部看到了导入/导出定义链接。但是有了这个,我能够导出整套队列、交换等。 我有一个 MQ 服务器,其中包含多个应用程序的 MQ 设置
我在 Eclipse IDE 中做了一个 Maven 项目,但在某些时候,我决定以其他名称复制并粘贴工作区位置中的文件夹,以避免在迄今为止工作正常的原始项目中进行一些错误配置,但是,我在执行中遇到了问
有没有办法备份在任何给定元素上设置的所有事件? 背景故事:我有一些代码,当用户将鼠标悬停在某个图标上时(想想悬停帮助文本),会显示绝对定位的“弹出窗口”。如果用户将鼠标悬停在弹出窗口上,它会停留在周围
我需要将 MySQL 数据库移动到新位置。根据workbench,数据库大小只有200MB,但有些表有数百万行,报告索引和数GB的数据长度。结果,EXPORT 的大小为 15GB,导出 DB 并将其复
我有一个工作数据库 - 我想复制它的所有数据(甚至只是其中的 1 个表)并在磁盘上创建备份,并在另一个位置(不是同一台计算机)上创建一个“备份”数据库。另一台计算机未连接到互联网 我该怎么做? 最佳答
我有一个实时数据库,我想要做的是制作一份副本。我可以通过 SSH 和 phpMyAdmin 访问 MySQl。是否有一个命令可以在单个命令/操作中复制/备份数据库,而无需使用导出/导入? 谢谢 最佳答
我是 PostgreSQL 的新手,我正在寻找备份数据库的方法。我知道有 3 种方法 pg_dump,快照和复制以及使用 WAL。您建议使用哪一个来完整备份数据库?如果可能,请提供代码片段。 最佳答案
如何快速备份/恢复mysql数据库中的数据? 最佳答案 mysqldump命令行备份最快, (使用mysql命令行恢复,mysql -u #username# -p #database# < #dum
从管理的角度来看,我是 MySQL 的新手。 在过去的几个小时里,我一直在谷歌上搜索,但没有成功,我想知道是否有人可以为我指明正确的方向,让我知道要用谷歌搜索什么或提出建议。 基本上,我正在寻找有关如
我需要备份创建模式附带的数据库(转储)。使用 putty(通过 SSH)完成这项工作的命令行是什么?我研究并思考了这个命令,但它只执行表备份和数据。 mysqldump -h HOST -u LOGI
我正在尝试创建一个将整个/dev/sda1 备份到/mnt/Backup 的 bash 脚本 /dev/sda1 457G 3.5G 431G 1% / /dev/sdb1
我是一名优秀的程序员,十分优秀!