如何阻止文件被iTunes和iCloud同步 How do I prevent files from being backed up to iCloud and iTunes?
2015-01-28 14:08
701 查看
http://blog.csdn.net/i2c_rs485/article/details/7386444
解决应用被打回的错误:
We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.
In particular, we found that on launch and/or content download, your app stores 2.3MB. To check how much data your app is storing:
先阅读官方说明:
https://developer.apple.com/library/ios/#qa/qa1719/_index.html
使用方法:
//iOS 5.0.1
对文件夹的path使用这两个方法中的任意一个,就可以使该目录和该目录包含的所有文件和文件夹不被icloud和itunes同步了!
对于数据的同步与否的设计规则 详细看上面的官方说明链接。
注意:setxattr在iOS 5.0.1之前的系统里不会起作用的,(但是那些系统也没有iCloud只有iTunes^.^)。经测试发现虽然不会起作用,但调用该函数也不会引起空指针错误。 这是一项挺有意思的技术:新系统里加入了原先系统里没有的func,在原先的系统里调用,居然没有nullpoint错误。 莫非这函数地址早就存在,预留好了后面把功能挂上? 奇怪了。
另外补充一下,对这个特性的测试要有耐心,因为icloud识别应用程序里要同步的数据量大小显示要等几秒(菊花。。),
参考文档:apple官方文档,
stackoverflow问答:http://stackoverflow.com/questions/8694112/adding-the-do-not-backup-attribute-to-a-folder-hierarchy-in-ios-5-0-1
原文链接:http://chishangjin.sinaapp.com/?p=14
解决应用被打回的错误:
We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.
In particular, we found that on launch and/or content download, your app stores 2.3MB. To check how much data your app is storing:
先阅读官方说明:
https://developer.apple.com/library/ios/#qa/qa1719/_index.html
使用方法:
//iOS 5.1 and later + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { if (![[NSFileManager defaultManager] fileExistsAtPath: [URL path]]) { NSLog(@"addSkipBackupAttributeToItemAtURL file not exist, URL = %@", URL); return NO; } 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; }
//iOS 5.0.1
#import "sys/xattr.h" - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { const char* filePath = [[URL path] fileSystemRepresentation]; const char* attrName = "com.apple.MobileBackup"; u_int8_t attrValue = 1; int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); return result == 0; } - (void)addSkipBackupAttributeToPath:(NSString*)path { u_int8_t b = 1; setxattr([path fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); }
对文件夹的path使用这两个方法中的任意一个,就可以使该目录和该目录包含的所有文件和文件夹不被icloud和itunes同步了!
对于数据的同步与否的设计规则 详细看上面的官方说明链接。
注意:setxattr在iOS 5.0.1之前的系统里不会起作用的,(但是那些系统也没有iCloud只有iTunes^.^)。经测试发现虽然不会起作用,但调用该函数也不会引起空指针错误。 这是一项挺有意思的技术:新系统里加入了原先系统里没有的func,在原先的系统里调用,居然没有nullpoint错误。 莫非这函数地址早就存在,预留好了后面把功能挂上? 奇怪了。
另外补充一下,对这个特性的测试要有耐心,因为icloud识别应用程序里要同步的数据量大小显示要等几秒(菊花。。),
参考文档:apple官方文档,
stackoverflow问答:http://stackoverflow.com/questions/8694112/adding-the-do-not-backup-attribute-to-a-folder-hierarchy-in-ios-5-0-1
原文链接:http://chishangjin.sinaapp.com/?p=14
相关文章推荐
- iPhone开发:如何阻止文件被iTunes和iCloud同步 How do I prevent files from being backed up to iCloud and iTunes?
- 如何从操作系统安装文件提取驱动文件/ How to extract driver files from setup files (win 7)
- How To Automate Cleanup Of Dead Connections And INACTIVE 【如何自动清理ORACLE中的死连接和非活动会话】
- How to use logrotate to manage log files in linux(如何在Linux中使用logrotate去管理日志文件)
- OS--阻止文件被iTunes和iCloud同步,Do Not Backup属性
- How to Copy Archivelog Files From ASM to Filesystem and vice versa
- 如何在MMIT上使用WMLScript文件(How To Use WMLScript Files With MMIT)
- How to extract controlfiles, datafiles, and archived logs from SMR backupsets without using RMAN
- Linux恢复被删除的文件 How To Recover Deleted Files From Your Linux System
- How To Use XDOLoader to Manage, Download and Upload Files? (文档 ID 469585.1)
- How do I write to files using cheerio and request in node?
- 如何使用SSH向IPOD Touch2传输文件 - How to SSH into iPod Touch 2G [Transfer Files, Apps via SSH Access]
- 如何象VS一样快速编辑Torque的CS文件(How to make your Torque CS files quickly)
- write to and read from files (读写文件)
- How To Use XDOLoader to Manage, Download and Upload Files? (DOC ID 469585.1)
- How to allow new records to be inserted, but prevent existing data from being edited
- How to easily open files and URLs from the command line
- How to collect stats of apps from CloudFoundry and do analysis?
- 如何使用SSH向IPOD Touch2传输文件 - How to SSH into iPod Touch 2G [Transfer Files, Apps via SSH Access] 如何使用SSH向IPOD Touch2传输文件 - How to S
- how to remove file and commit from history(如何移除 commit 歷史紀錄)