ios - Variable Type convention for binary or yes/no variables in Core Data -


ios novice php background learning core data here.

what variable type best practice binary i.e. yes/no or true/false values in core data?

in php convention use tinyint or 0,1. core data seems have boolean primitive can use nsnumber, int etc.

i'm using boolean variable type in .xcdatamodel file running lot of problems capturing binary variables switches, trying if else comparisons , forth right way. thx.

coredata's bool type not "real" boolean, since boolean not object. should store them nsnumber , convert them boolean.

set:

[entity setbinary:[nsnumber numberwithbool:yes]]; 

get:

bool isbinaryon = [[entity binary] boolvalue]; 

i hope helps!


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -