we want to encrypt some attributes of our entity, but still be able to perform fetches and predicates using the attribute, without the special care for predicates and etc...
person attribute name is encrypted
NSPredicate * predicate = [NSPredicate predicateWithFormat:@"name like JOHN"];
johns = [persons filteredArrayUsingPredicate: predicate];
core data entity
.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
您实际上可以实现自定义访问器方法,请阅读此apple doc 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.