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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:33:53+00:00 2026-05-16T18:33:53+00:00

I have used NSMutable Dictionary and NSMutable Array. The datas are to be stored

  • 0

I have used NSMutable Dictionary and NSMutable Array. The datas are to be stored and retrieved from plist(Documents Directory) using NSArray of NSMutable Dictionary.

Edit:

I have six buttons in the scroll view, on clicks the button, the data is to be displayed in the table view using XML parsing. i have put the data into the plist and retrieved from plist and displayed in the table view. In the table view, i have one button as footer view. On clicks the button, the next items are to parsed and displayed in the table view. The next parsing contents are adding to the previous contents. I have used NSMutable Dictionary for storing the data into the plsit.

Here my code is,

The return array is returns the parsing details and.

  -(void)callFromSecondaryThread:(NSMutableArray *)returnArray{

     if([returnArray count] > 0)
     {
         for(NSMutableArray *arr in returnArray)
         {
             //[copyArray addObjectsFromArray:returnArray];  
             //[copyArray addObject:returnArray];   
             //[ ???? ??? ??????? ?????? ] 
         } 
               [self.table reloadData];
     }

//First time save the contents in the plist and loading the content from the plist and displayed in the table view

 -(void)startParsingBasedOnSelectedTabValue:(NSString *)strValue {//button value

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    if (![self checkFileIsThere:tagString]) { //checks the plist is available or not, if its not available, then create a new file. i have created separate plist file for each buttons.

    if([copyArray count] > 0)
    {
        [copyArray removeAllObjects];
    }

    feedDictionary = [[NSMutableDictionary alloc]init];

    //send url for parsing [self parsingMethod];

    [feedDictionary setObject:copyArray forKey:tagString];

    [feedDictionary writeToFile:[self saveFilePath:tagString] atomically:NO];

    [feedDictionary release];

    } else{

             NSString *stringPtah = [self saveFilePath:tagString];

             NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithContentsOfFile:stringPtah];

             NSMutableArray *arrArray = [dictionary objectForKey: tagString];

             copyArray = [arrArray copy];
                   }  
            [self.table performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
            [pool drain];
       }


     //On clicks the next 10 details button, 

 -(void) details:(NSString *) strpageCount
 {

    if ([self checkFileIsThere:tagString]) {

    [[NSFileManager defaultManager]  removeItemAtPath:[self saveFilePath:tagString] error:NULL];  // remove the old plist here

     NSMutableDictionary *feedDictionary1 = [[NSMutableDictionary alloc]init];

     [self parsingMehods];

     [feedDictionary1 setValue:copyArray forKey:tagString];

     [feedDictionary1 writeToFile:[self saveFilePath:tagString] atomically:NO];

     [pageDictionary setValue:pString forKey:tagString];

     [feedDictionary1 release];

     [self.table reloadData]; // After writing the file in the plist, i just reload the table data and displayed the contents in the table view. 

    }
 }

But i can get successfully added the datas in the copyArray sometimes only. which means, i have click the next button after loading the view, it works fine. But if i moved the next button and visits that view and come back to the first view and clicks the next button, i get crashed my apps.

I can get the datas in the returnArray and copyArray is my main array and its used to display the contents(CellforRowatindex).ReturnArray is a mutable array and its contains the title,date,image,etc.,

On clicks the (next 10 details) button, i have removed my old plist and create a new plist with the new contents.(For Eg:first plist has 10 contents in the copy array and returns 4 new content. it would be added 14 contents in the copy array and displayed in the table view). In first time loading my apps, clicks the next button, the array will be added successfully. But i visit the the remaining buttons and details, then comeback to the view, and clicks the next button, i get crashed my apps and get this exception,

     Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArray removeObjectAtIndex:]: mutating method sent to immutable object' 

I have spent a many hours to this problem and till haven’t get a solution.

Please mentioned what i have done wrong in my code..

Please Guide me?.

Thanks!

  • 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-16T18:33:53+00:00Added an answer on May 16, 2026 at 6:33 pm

    The line copyArray = [arrArray copy]; should be copyArray = [arrArray mutableCopy];. You are getting the error because copyArray is immutable.

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

Sidebar

Related Questions

I have used NSMutable Dictionary and NSMutable Array. The datas are to be stored
I have successfully created video from uiimages using AVAssetWriter. But as soon as the
I have an NSMutable dictionary that contains file IDs and their filename+extension in the
I have a custom user type that is used to map from a decimal
I have my shared user defaults plist that looks something like: menuItems (Array) Item
I have used UIWebview to load a web page using loadRequest: method, when I
i used to have a method to post: -(void) execMethod:(NSString*)methodName andParams:(NSArray*)parameters withID:(NSString*)identificator { //RPC
So I have an NSMutable array that I populate in viewDidLoad and then I
I have used the silverlight control in CRM 2011.It also published on form but
We have used Shibboleth to authenticate users. It works great. The issue is that

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.