我在ModelObject
中有以下数据,我希望所有键值 1 。
{
id: "6",
hemophilia: "1",
diabetes: "0",
hepatitis: "1",
hiv_positive: "0",
skin_diseases: "1",
eczema: "0",
allergies: "0",
autoimmune_diseases: "0",
herpes: "0",
infectious_diseases: "0",
epilepsy: "0",
cardiovascular_problems: "0",
anticoagulant: "0",
pregnant: "0",
daily_basics_medications: "0",
pacemaker: "0",
wounds_healing_problems: "0",
hormone_therapy: "0",
seborrheic_dermatitis: "0",
regular_exercise: "0",
dust_exposure: "0"
}
基于以上数据,我的输出将是:
["hemophilia","hepatitis","skin_diseases"]
我希望通过Predicate
或某种过滤形式,以便在最短的时间内获得预期的输出。
我的Model类如下所示:
@interface MyMedical : NSObject
@property (nonatomic, retain) NSString* medicalId;
@property (nonatomic) BOOL hemophilia;
@property (nonatomic) BOOL diabetes;
@property (nonatomic) BOOL hepatitis;
@property (nonatomic) BOOL hiv_positive;
@property (nonatomic) BOOL skin_diseases;
@property (nonatomic) BOOL eczema;
@property (nonatomic) BOOL allergies;
@property (nonatomic) BOOL autoimmune_diseases;
@property (nonatomic) BOOL herpes;
@property (nonatomic) BOOL infectious_diseases;
@property (nonatomic) BOOL epilepsy;
@property (nonatomic) BOOL cardiovascular_problems;
@property (nonatomic) BOOL anticoagulant;
@property (nonatomic) BOOL pregnant;
@property (nonatomic) BOOL daily_basics_medications;
@property (nonatomic) BOOL pacemaker;
@property (nonatomic) BOOL wounds_healing_problems;
@property (nonatomic) BOOL hormone_therapy;
@property (nonatomic) BOOL seborrheic_dermatitis;
@property (nonatomic) BOOL regular_exercise;
@property (nonatomic) BOOL dust_exposure;
- (id) initWithNSDictionary:(NSDictionary*)data;
@end
先谢谢。