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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:30:46+00:00 2026-06-14T21:30:46+00:00

I have an NSDictionary with four objects. Each object is an NSDictionary containing thousands

  • 0

I have an NSDictionary with four objects. Each object is an NSDictionary containing thousands of objects. I have verified through logging of the description of the top level dictionary that it contains what it is supposed to. However, when I run the code below, to enumerate the objects in that top level dictionary, the debugger is showing an error, indicating that the returned object is a sting rather than a dictionary.

Here is the code:

for(id synsetsForPos in dictionaryOfSynsetDictionaries) {
    NSLog(@"synsetsForPos is class of %@ with description %@", [synsetsForPos class], [synsetsForPos description]);

(I originally typed synsetsForPos as NSDictionary, but the results described here are the same.)

In the debugger, I halt at the log statement to get this in the console:

(lldb) po [synsetsForPos class]
(id) $2 = 0x016e2c8c __NSCFConstantString
(lldb) po [[dictionaryOfSynsetDictionaries objectForKey:@"n"] class]
(id) $3 = 0x016d3e0c __NSCFDictionary
(lldb) po [[dictionaryOfSynsetDictionaries objectForKey:@"r"] class]
(id) $6 = 0x016d3e0c __NSCFDictionary
(lldb) po [[dictionaryOfSynsetDictionaries objectForKey:@"v"] class]
(id) $7 = 0x016d3e0c __NSCFDictionary
(lldb) po [[dictionaryOfSynsetDictionaries objectForKey:@"a"] class]
(id) $8 = 0x016d3e0c __NSCFDictionary
(lldb) po [dictionaryOfSynsetDictionaries allKeys]
(id) $10 = 0x653662a0 <__NSArrayI 0x653662a0>(
r,
n,
v,
a
)

Then, letting the log statement execute, I get this:

2012-11-24 22:32:41.069         [6037:fb03] synsetsForPos is class of __NSCFConstantString with description r
(lldb) 

followed by this error message:

2012-11-24 22:41:21.287         [6037:fb03] -[__NSCFConstantString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x1faf8

I don’t understand what’s going on here, why this is not being treated as a dictionary in the fast enumeration code.

  • 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-14T21:30:48+00:00Added an answer on June 14, 2026 at 9:30 pm

    Fast enumeration of a dictionary iterates over keys not objects: documentation.

    Use enumerateKeysAndObjectsUsingBlock:
    instead. It is probably just as fast – see discussion here.

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

Sidebar

Related Questions

I have a single NSDictionary object which contains a large number of custom objects.
My Situation: I have an NSDictionary object. Keyed by NSNumber. Values are custom objects.
I have a NSDictionary object with deep structures in it like arrays containing further
I have about 20,000 NSDictionary s. Each dictionary contains three NSString s. The dictionaries
I have a NSDictionary object containing key/value pairs. I want to be able to
I have a NSDictionary that I get from a webservice. Each object in this
I have some NSDictionary objects stored in an NSArray called telephoneArray . I fetch
I have customized uitableViewcell in which each cell show four data which are related
How I must remove objects? For example, I have NSDictionary and some NSStrings from
I have an NSDictionary where each key points to an array. I later want

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.