The entity User is not key value coding-compliant for the key “dateEndSubscription”

前端 未结 1 1269
刺人心
刺人心 2021-01-27 22:25

I have a swift project with 3 entities in my xcdatamodeld: Access, CustomerInfo and User. I am trying to save the dateEndSubscription separately in the User. When I am trying to

1条回答
  •  离开以前
    2021-01-27 22:47

    The json message contains the key dateEndSubscription but the attribute in your User entity is named dateEnd so they doesn’t match.

    A few options to solve this in your saveUser method

    Change API.DateEnd to dateEnd but maybe that will infer with the decoding of the json message.

    Don't use API key but instead hardcode attribute name

     user.setValue(dateEnd, forKey: "dateEnd")
    

    and lastly use the property of the User class directly

     user.dateEnd = dateEnd
    

    You need to change saveCustomerInformation as well since you are working with a User object there as well although it's unclear why.

    0 讨论(0)
提交回复
热议问题