Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:18:21+00:00 2026-06-09T04:18:21+00:00

so I am happily slamming data into my system using JSON and setValuesForKeysWithDictionary until

  • 0

so I am happily slamming data into my system using JSON and setValuesForKeysWithDictionary until I run into an object that has an NSDate property.

The JSON contains dates with the following format:

BackOrderDate: "2011-03-15T00:00:00"

This gives me an error:

'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "BackOrderDate"; desired type = NSDate; given type = __NSCFString; value = 2011-03-15T00:00:00

I am using JSON.NET with MVC and the following settings with it:

JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
serializerSettings.Converters.Add(new Newtonsoft.Json.Converters.IsoDateTimeConverter());
string json = JsonConvert.SerializeObject(objects, Formatting.None, serializerSettings);
return Content(json);

Any ideas on how to deal with this issue? I do not want to lose the use of setValuesForKeysWithDictionary since it so fricking fast.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:18:23+00:00Added an answer on June 9, 2026 at 4:18 am

    I assume you’re using Core Data (since Core Data produces the error you posted) and that your entity has a property named “BackOrderDate” of type “Date”.

    The problem is that JSON doesn’t have a “Date” data type. In your .NET code you’ve handled this by telling the JSON serialize to convert dates to IS-formatted strings.

    You need to perform the opposite conversion when you parse the JSON data in your iOS app, before you pass the data to setValuesForKeysWithDictionary:.

    You can parse a string into an NSDate using an NSDateFormatter, and you can easily find lots of examples of that on the web.

    How you perform the parsing before calling setValuesForKeysWithDictionary: depends on what you’re using the parse the JSON.

    If you’re using Apple’s NSJSONSerialization, you should probably use the NSJSONReadingMutableContainers option. Then go into the dictionary and replace the date string with an NSDate object before calling setValuesForKeysWithDictionary:.

    If you’re using some other JSON parser (like SBJSON), I don’t know the best way to do the replacement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was happily using outline property until I came to know that it is
I'm happily using proc_open to pipe data into another PHP process. something like this
I am very happily using git-svn, though I noticed that git has a different
I have a ListBox which happily displays data using a code-behind MVVM object. However,
I've been happily using a replacement for NSLog called DLog so that I don't
I was happily coding, thinking that everything was alright, until.. libtool: link: g++ -g
I've been very happily using PredicateBuilder but until now have only used it for
I have a project that currently compiles happily on my dev machine using VS
I am happily launching a program in a windows system from Lua using strProgram
We have a windows service that has been happily running in production for over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.