ios - issue in NSPredicate for NSString -
in application using coredata.amount values stored in coredata nsstring. in interface builder have 2 textfields.when enter amount on textfields amounts accept minimum value , maximum value.i want amounts between minimum , maximum amounts have entered.
what solution.i goes through way example not worked on project because want convert string integer on nspredicate method.
my code is
nspredicate *p1= [nspredicate predicatewithformat:@"(amount.intvalue => %@) && (amount.intvalue <=%@)", text1.intvalue,text2.intvalue]];
note amount stored nsstring in coredata
nspredicate *p1= [nspredicate predicatewithformat:@"(amount.intvalue => %@) && (amount.intvalue <=%@)", text1.intvalue,text2.intvalue]];
you shouldn't comparing numbers , strings. compare 1 or other. in case, want compare numbers. should change source data stored in model number.
=>
should >=
%d
integer parameter format, , text1.intvalue
returns integer. using %@
expects on jest , won't want.
log contents of predicate can see contains. mainly, change type of data in model.
Comments
Post a Comment