特定のディレクトリをバックアップ対象から外す方法

投稿者: | 2015年6月8日
この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので十分ご注意ください。

当該ディレクトリをバックアップ対象から外すには、バックアップ対象外属性を付与します。

[bash highlight=”4″]
– (BOOL)addExcludedFromBackupToItemAtPath:(NSString*)filePathString
{
NSError *error = nil;
BOOL result = [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
if (!result) {
// error
}
return result;
}
[/bash]

特にエラー処理はしていませんが、単純に書くとこのような感じです。

[adsense]

iCloud絡みの「2.23 – Apps must follow the iOS Data Storage Guidelines or they will be rejected」対策の一つでもありますね。

詳細は本家のこちらをどうぞ。


コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.