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 nsentitydescription api generate attribute keys. use entitydescription.propertiesbyname.allkeys generate list of attribute names of entity.

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -