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 8959123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:22:33+00:00 2026-06-15T15:22:33+00:00

In my project I get a list of dates from an XML string using

  • 0

In my project I get a list of dates from an XML string using an NSXMLParser. The object (called DatesXML) that the parser puts the information into has a

@property (nonatomic,strong) NSDate *DATE;
@property (nonatomic,strong) NSString *NAME;

among many other properties.

My parser is going to return an array (called dateItemsFromXML) of DatesXML objects. After the parser finishes, I do

NSMutableDictionary *datesFromXMLDictionary = [[NSMutableDictionary alloc] init];
for (DatesXML *item in dateItemsFromXML)
{
    [datesFromXMLDictionary setValue:item.DATE forKey:item.NAME];
}

Later, I do

if ([[datesFromXMLDictionary objectForKey:@"OneOfMyNames"] isEqualToDate:[NSDate date]])

I’m getting an “unrecognized selector” error on this if statement. I put in a breakpoint, and when I put po [datesFromXMLDictionary objectForKey:@"OneOfMyNames"] in the Console, I get (id) ... 12/3/2012.

Why is the Console telling me it is an id object instead of an NSDate object? Is that information lost when it is put into the dictionary (or anywhere else for that matter)?

  • 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-15T15:22:34+00:00Added an answer on June 15, 2026 at 3:22 pm

    As pointed out by Matthias Bauch in the comments, the root of my problem ended up being because I had an NSString in my .DATE property. When the parser was loading up my DatesXML object, it loads everything in as a string by default. As a result, it loaded my .DATE property with a string (and did so silently), even though .DATE is supposed to be an NSDate.

    I put an NSDateFormatter into my parser to turn the string from the xml into an NSDate, then put that NSDate into my .DATE property. That eliminated the error I was getting and I’m getting all the behavior I expected when I try to use the .DATE property elsewhere in my code.

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

Sidebar

Related Questions

I want to get a list of all the forms in the project i
In my project ,I get json data from Server,there's a field named 'creat_at' in
I'm using Reachability on my project to get the type of connection used, but
Doing code analysis of the project and get the message Reference-counted object is used
i have a list of event Ids returned from an xml document as shown
In a project I am working on, I have a ComboBox with dates that
I have an ASP.NET project that uses XML Serialization for the main operation for
I'm returning a list of .NET serialized objects (Project objects) from a JSON web
Does anyone know if there is a way to get a list of dates
I have a project that is using git and have tagged all the releases

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.