2012-02-10 56 views
0

我們要加密我們的實體的某些屬性,但仍然能夠執行使用屬性取和謂詞,沒有特殊照顧謂詞等..核心數據加密atributes

人員屬性名稱被加密

NSPredicate * predicate = [NSPredicate predicateWithFormat:@"name like JOHN"]; 
johns = [persons filteredArrayUsingPredicate: predicate]; 

核心數據實體

.H

@interface Person : NSManagedObject 

@property (nonatomic, retain) NSString * name; // crypted 
@property (nonatomic, retain) NSString * description; // crypted 
@property (nonatomic, retain) NSString * someAtrribute; 

@end 

.M

@implementation File 

@dynamic name; 
@dynamic description; 
@dynamic someAttribute; 

@end 
  • 我不能改變@dynamic到@synthesize和執行我的自定義setter和getter
  • 我可以改變加密屬性c_name和自定義添加合成的屬性名但這不會對謂詞起作用

回答

1

你其實可以執行c ustom訪問器方法,請閱讀此apple doc