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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:36:17+00:00 2026-06-10T21:36:17+00:00

I am trying to change the contents of an array while enumeration. To avoid

  • 0

I am trying to change the contents of an array while enumeration. To avoid the warning ,”the array was mutated while being enumerated” i made a copy of the array and done the autorelease like this-

int iKeyArrayCount=0;
        for(NSString *keyEntity in [[keyArray copy]autorelease])
        {
            [keyArray replaceObjectAtIndex:iKeyArrayCount withObject:[keyEntity stringByReplacingOccurrencesOfString:@"\"" withString:kMPVTBlankString]];
            [keyArray replaceObjectAtIndex:iKeyArrayCount withObject:[keyEntity stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
            iKeyArrayCount++;
        }

My confusion is regarding the enumeration over that copy of keyArray. While enumeration is it like , a copy of keyArray is formed each time the for loop executes? Or only one copy of that keyArray is formed during the whole process of enumeration.

  • 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-10T21:36:19+00:00Added an answer on June 10, 2026 at 9:36 pm

    In that code snippet [[keyArray copy] autorelease] is executed once only, and the result is used at the object being iterated.

    In other words, “only one copy of that keyArray is formed during the whole process of enumeration” is correct.

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

Sidebar

Related Questions

I am trying to change the content of the div using javascript/jquery. While the
I'm trying to change the contents of my two Spinners. So I've got my
I am trying to modify the contents of a 2D array in C++ using
I am trying to copy the contents of an arraylist into another object. I
I'm trying to change a value in a multidimensional array but getting a compiler
While trying to simulate a bit of PHP behaviour I stumbled across this: $a=array(0
I'm trying to change the content of a ContentPresenter to one of my View
I'm trying to change the owner of a folder (myFolder) and all its content
I'm trying to persuade a SiteMesh decorator to change the content-type of the response,
I am trying to create a status window which content(textbox) should change in a

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.