xcode - Coredata NSFetchRequest DictionaryResultType null properties Swift -
hello guys using code fetch result coredata
func getrequest(entirydesc:nsentitydescription) -> nsfetchrequest{ var request:nsfetchrequest = nsfetchrequest() request.entity = entirydesc request.resulttype = nsfetchrequestresulttype.dictionaryresulttype return request } now problem need attributes contains nil value excutefetchrequest returns properties have values , there work around return null attributes string "" every time fetch ? advanced
of course, can dispense .dictionaryresulttype , fetch normal managed objects. there few cases dictionary result type makes sense.
if want construct dictionary attributes filled out (for whatever opaque reason), remember 2 things:
- make sure insert null values objects
nsnull() - you can use
nsentitydescriptionapi generate attribute keys. useentitydescription.propertiesbyname.allkeysgenerate list of attribute names of entity.
Comments
Post a Comment