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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:50:05+00:00 2026-06-06T04:50:05+00:00

In my iPhone app. I am copying the one mutable array(with dictionary) to another.

  • 0

In my iPhone app.

I am copying the one mutable array(with dictionary) to another.

It is like

resultsToDisplay = [[[NSMutableArray alloc]initWithArray:resultsPassed]mutableCopy];


  2012-06-21 17:07:07.441 AllinoneCalc[3344:f803] Results  To Display (
        {
        lbl = "Monthly EMI";
        result = "75.51";
    }
)
2012-06-21 17:07:08.224 AllinoneCalc[3344:f803] Results Passed (
        {
        lbl = "Monthly EMI";
        result = "75.51";
    }
)

Then I am modifying one of them .

[[resultsToDisplay objectAtIndex:i] setValue:[NSString stringWithFormat:@"%.2f",[[[resultsPassed objectAtIndex:i] valueForKey:@"result"] floatValue]] forKey:@"result"];

But what is happening that both are getting edited.

2012-06-21 17:07:08.703 AllinoneCalc[3344:f803] Results Passed (
        {
        lbl = "Monthly EMI";
        result = "75.00";
    }
)
2012-06-21 17:07:08.705 AllinoneCalc[3344:f803] Results  To Display (
        {
        lbl = "Monthly EMI";
        result = "75.00";
    }
)

They both are referring to the same copy.

How to solve this. I want to modify only one 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-06-06T04:50:06+00:00Added an answer on June 6, 2026 at 4:50 am

    You are only copying the array of object pointers, not the object themself. See this article on deep copying.

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

Sidebar

Related Questions

My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen
My iPhone app is getting ready to go to production and we like to
I would like to provide two different versions of my iPhone app on the
My iPhone app can't seem to use soft keyboards that doesn't use the US-like
The iphone app I am creating has an array of commonly used settings. These
my iphone app crashes unexpectedly and looking at the crash log I can't tell
The iPhone app that I am working on requires GET calls to a 3rd
My iPhone app started logging this error: lo->hi recycling invariant violated! followed by: Program
My iPhone app generally uses under 5MB of living memory and even in the
My iphone app called Google Local Search(non javascript version) to behave some search business.

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.