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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:33:43+00:00 2026-06-15T20:33:43+00:00

I am doing the ‘Your Second App’ tutorial and it has me add the

  • 0

I am doing the ‘Your Second App’ tutorial and it has me add the line of code below that is a setter for the masterBirdSightingList property. I just have a basic questions on it:

Is this line the same as if I were to synthesize it? If not, what makes it different?

- (void)setMasterBirdSightingList:(NSMutableArray *)newList
{
     if (_masterBirdSightingList != newList) {
            _masterBirdSightingList = [newList mutableCopy];
     }
}
  • 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-15T20:33:44+00:00Added an answer on June 15, 2026 at 8:33 pm

    If the property is defined as:

    @property (nonatomic, copy) NSMutableArray *masterBirdSightingList;
    

    then implementing this method is not the same as simply using @synthensize masterBirdSightingList;.

    Defining a property with copy semantics for a mutable container type doesn’t actually work as expected using the default synthesized setter.

    Without the explicit method, you actually end up with the property referencing an immutable copy of the array.

    By using the code you posted, instead of relying on the synthesized method, you get the proper and expected behavior of having a mutable copy of the original array.

    Another way to look at this is that calling copy on an NSMutableArray returns an NSArray, not an NSMutableArray. This is why the default synthesized property setter doesn’t work as expected (when dealing with a mutable container property). So you must implement the setter yourself and call mutableCopy on the parameter.

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

Sidebar

Related Questions

Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some code reading and stumbled upon this snippet that I haven't seen before:
Doing some code reviews lately I came across a number of classes that have
Doing a Google search I found several command-line SCEP clients that I can download
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing some homework here (second assignment, still extremely green...). The object is to read
Doing code analysis of the project and get the message Reference-counted object is used
Doing a search using django-sphinx gives me results._sphinx that says there were 68 results,
Doing a bit of reading around domain driven design and it seems that you're
Doing some R&D for my company. We are trying to have a listView 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.