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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:59:49+00:00 2026-05-31T22:59:49+00:00

I have this NSDictionary: Categorys = { Category = ( { categoryDescription = {

  • 0

I have this NSDictionary:

Categorys =     {
        Category =         (
                        {
                categoryDescription =                 {
                    text = "  Description";
                };
                categoryIconPath =                 {
                    text = "  7.jpg";
                };
                categoryId =                 {
                    text = "  25";
                };
                categoryName =                 {
                    text = "  My Photos";
                };
                categoryStatus =                 {
                    text = "  ON";
                };
                publicPrivate =                 {
                    text = "  Private";
                };
                userId =                 {
                    text = "  2";
                };
            },
.................. 

I want to get the categoryName (like here My Photos) into my NSArray.

How can I do this?

I am unable to get it

I have tried this code from http://troybrant.net/blog/2010/09/simple-xml-to-nsdictionary-converter/

NSString *category = [[[[xmlDictionary objectForKey:@"Categorys"] objectForKey:@"Category"] objectForKey:@"categoryName"] stringForKey:@"text"];

but it gives error

2012-03-27 15:30:35.320 File[1481:903] -[NSCFArray objectForKey:]: unrecognized selector sent to instance 0x1462c0
  • 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-05-31T22:59:50+00:00Added an answer on May 31, 2026 at 10:59 pm

    In Categories, the object referenced by the Category key is an array, you can tell by the fact that its contents are bracketed by parentheses ( ... ) not braces { ... }.

    Looking at your code and breaking it down:

    NSString *category = [[[[xmlDictionary objectForKey:@"Categorys"] // This is the outermost dictionary 
                                objectForKey:@"Category"]             // This is an NSArray
                                    objectForKey:@"categoryName"] stringForKey:@"text"]; 
                                                      // This breaks NSArray doesn't respond to objectForKey:
    

    Breaking it down a bit, you need:

    NSDictionary* categorys = [xmlDictionary objectForKey:@"Categorys"];
    NSArray* categoryArray = [categorys objectForKey: @"Category"];
    NSDictionary* category = [categoryArray objectAtIndex: i];  // i is the index of the category you want e.g. 0
    // etc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the XML data: <Categorys> <Category> <categoryId>25</categoryId> <categoryName>My Photos</categoryName> <categoryDescription>Description</categoryDescription> <categoryIconPath>7.jpg</categoryIconPath> <userId>2</userId> <categoryStatus>ON</categoryStatus>
the question explains it all. For instance, if I have a NSDictionary like this
I have a class with an NSDictionary attribute. Inside this class I dispatch another
I have this NSDictionary that I want to load into a table view. It
I have a NSDictionary like this one. PhotoData = { 1 = { jf_photo_geotag
I have this code that can't send a Facebook request until now. NSDictionary *firstDict
I have this code NSDictionary *tempDict = [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects:@authorId,authorName,authorDescription,@image,nil] forKeys: [NSArray arrayWithObjects:@id,@name,@desc,@image,nil]];
I have this method: - (void)postDictionary:(NSDictionary *)dictionary toURL:(NSURL *)url forDelegate:(id)delegate withIdentifier:(NSString *)identifier; I want
I have this code now: This is iOS for(NSDictionary * dict in myMutableArray) {
I have this code to get NSStrings from an NSDictionary from an NSMutableArray but

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.