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

  • Home
  • SEARCH
  • 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 777513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:37:02+00:00 2026-05-14T19:37:02+00:00

What is the datatype you use to fetch items whose type is dictionary in

  • 0

What is the datatype you use to fetch items whose type is dictionary in plist i.e. nsmutabledictionary or nsdictionary? Because I’m using following code to retrieve dictionary objects from an array of dictionaries in plist.

NSMutableDictionary *_myDict = [contentArray objectAtIndex:0]; //APP CRASHES HERE

NSLog(@"MYDICT : %@",_myDict);
NSString *myKey = (NSString *)[_myDict valueForKey:@"Contents"] ; 

[[cell lblFeed] setText:[NSString stringWithFormat:@"%@",myKey]];

Here, on first line it’s showing me objc_msgsend. ContentArray is an nsarray and it’s contents are showing 2 objects that are there in plist. In plist they are dictionary objects. Then why this error?

Edit

Basically, the contents of my contentArray in console are as shown below :

CONTENT ARRAY :  
(
    {
    favourites = 0;
    id = 0;
    story = "This is my first record";
    timestamp = 324567;
},
    {
    favourites = 0;
    id = 1;
    story = "This is my second record";
    timestamp = 321456;
}
)

I want to retrieve these dictionary objects from content array.

  • 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-14T19:37:02+00:00Added an answer on May 14, 2026 at 7:37 pm

    NSDictionary. You can’t simply say

    NSMutableDictionary *_myDict = [contentArray objectAtIndex:0]; 
    

    and hope, that it’s a mutable dictionary now. It’s still a normal immutable distionary. So, you should write something like:

    NSMutableDictionary *_myDict = [NSMutableDictionary dictionaryWithDictionary:[contentArray objectAtIndex:0]];
    

    That’ll create mutable dictionary from one that is in the plist.

    You can read about it in the “Property List Programming Guide”, http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/PropertyLists/index.html

    Update:

    Also you have a strange plist contents. Available xml-plist types are mentioned here:
    http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html#//apple_ref/doc/uid/10000048i-CH3-SW1

    And overall xml-plist structure is described here:
    http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/PropertyLists/UnderstandXMLPlist/UnderstandXMLPlist.html#//apple_ref/doc/uid/10000048i-CH6-SW1

    Working piece of code

    void test() {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    
        NSMutableArray *arrayIWillWrite = [NSMutableArray array];
        NSMutableDictionary *dictionary;
    
        dictionary = [NSMutableDictionary dictionary];
        [dictionary setObject:[NSNumber numberWithInt:0] forKey:@"favourites"];
        [dictionary setObject:[NSNumber numberWithInt:0] forKey:@"id"];
        [dictionary setObject:@"This is my first record" forKey:@"story"];
        [dictionary setObject:[NSNumber numberWithInt:324567] forKey:@"timestamp"];
        [arrayIWillWrite addObject:dictionary];
    
        dictionary = [NSMutableDictionary dictionary];
        [dictionary setObject:[NSNumber numberWithInt:0] forKey:@"favourites"];
        [dictionary setObject:[NSNumber numberWithInt:1] forKey:@"id"];
        [dictionary setObject:@"This is my second record" forKey:@"story"];
        [dictionary setObject:[NSNumber numberWithInt:321456] forKey:@"timestamp"];
        [arrayIWillWrite addObject:dictionary];
    
        [arrayIWillWrite writeToFile:@"/Users/alex/test.plist" atomically:NO];
    
        NSArray *arrayThatWasRead = [NSArray arrayWithContentsOfFile:@"/Users/alex/test.plist"];
        NSLog(@"%@", arrayThatWasRead);
    
        NSDictionary *dictionaryFromArrayThatWasRead = [arrayThatWasRead objectAtIndex:0];
        NSLog(@"%@", dictionaryFromArrayThatWasRead);
    
        [pool release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best datatype to use for storing moderate amounts of text in
Why would someone use numeric(12, 0) datatype for a simple integer ID column? If
Which sql data type should we use for number bases primary key: int bigint
I am trying to use the new DATETIMEOFFSET data type in SQL 2008 but
Or better said: When to use array as a field data type in a
Is there a list describing all of the data_type parameters you can use in
I have an XML datatype and want to convert an element into a sql
I have a column which has a datatype : datetime. But now i want
I can easily define a datatype for a node of a directed graph. data
The XML Schema Part 2 specifies that an instance of a datatype that is

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.