0

How can i add a mutable array in the same like the old one?

I tried this code but it doesn't work:

 - (void)didParsingApiBusinesses:(NSMutableArray *)businesses
 {
     NSZone *zone = [entriesBusinessesArray zone];
     entriesBusinessesArray = [businesses mutableCopyWithZone:zone];
 }
keep on you
  • 310
  • 6
  • 21

2 Answers2

1

Two things:

  1. Zones aren't used by the framework anymore.
  2. You shouldn't call mutableCopyWithZone: directly; instead call mutableCopy.

So all you need is:

- (void)didParsingApiBusinesses:(NSMutableArray *)businesses
{
    entriesBusinessesArray = [businesses mutableCopy];
}
jlehr
  • 15,557
  • 5
  • 43
  • 45
1

Use mutableCopy directly.

I think NSZone is not supported by objective C now.

Thank you.

Hemang
  • 1,224
  • 9
  • 15
  • 1
    Just to be clear, `NSZone` is in the Foundation framework. It's not part of the Objective-C language. – jlehr Apr 02 '12 at 20:47