查看完整版本: [-- New file attribute for non-purgeable, non-backed up files --]

CocoaChina 开发讨论区 -> 代码例子区 -> New file attribute for non-purgeable, non-backed up files [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

lvyile 2011-11-03 23:35

New file attribute for non-purgeable, non-backed up files

                        
            
New file attribute for non-purgeable,non-backed up files
            iOS 5.0.1 beta introduces a new "do not back up" attribute for specifying files that shouldremain on device, even in low storage situations. Use this attribute with data that can berecreated but needs to persist even in low storage situations for proper functioning of your appor because customers expect it to be available during offline use. This attribute works onmarked files regardless of what directory they are in, including the Documents directory. Thesefiles will not be purged and will not be included in the user's iCloud or iTunes backup. Becausethese files do use on-device storage space, your app is responsible for monitoring and purgingthese files periodically.
            To set the "do not back up" attribute, add the following method to a class in your application.Whenever you create a file that should not be backed up to iCloud, write the data to the fileand then call this method, passing in a URL that points to the file.




<pre class="brush:objc; toolbar: true; auto-links: false;">

#include <sys/xattr.h>
- (void) AddSkipBackupAttributeToFile: (NSURL*) url
{
    u_int8_t b = 1;
    setxattr([[url path] fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}

</pre>


巫山冰 2011-11-04 00:39
wow,大动作真是神速。

巫山冰 2011-11-04 13:59
刚刚发现,iOS 5.0.1 在 iPad2上的地图,在地图选项上选择“混合”时,卫星图和道路图一致了。。。。


查看完整版本: [-- New file attribute for non-purgeable, non-backed up files --] [-- top --]



Powered by PHPWind v7.5 SP3 Code ©2003-2010 PHPWind
Gzip disabled

You can contact us