RestKit .20 with CoreData - How to set default values -


i using restkit .20 coredata. have restkit calling json api , storing response coredata model without issues.

my question how set default values @ mapping time not on response?

in situation, downloading list of alerts alert inbox. need show alerts have been read on local device. have coredata attribute on entity model called alertread (boolean)which update when user marks alert 1=read.

my question how set default value of attribute 0=unread @ time data retrieved , mapped.

i tried set default value in xcdatamodeld file , did not work. appears restkit sets value nil @ mapping time.

one point of clarification..i not think want set attribute mapping attribute value on api because refresh of data override current data on local database.

current code mapping.

rkentitymapping* alertmapping = [rkentitymapping mappingforentityforname:@"alertmessage" inmanagedobjectstore:_managedobjectstore];     [alertmapping addattributemappingsfromdictionary:@{      @"alertsubject": @"subject",      @"alertdetailmessage": @"detailmessage",      @"id": @"alertid",      }];    

thanks suggestions. g

look @ using kvc validation (which restkit utilises heavily) verify incoming data restkit , rejecting update if isn't appropriate. should used in conjunction default values set in xcdatamodel.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -