0

I am using this code in xcode and error "'NSAutoreleasePool' is unavailable: not available in automatic reference counting mode" is showing. What is the correct way to write this code in latest xcode version.

  {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        NSLog(@"Base class Person Object");
        Person *person = [[Person alloc]initWithName:@"Raj" andAge:5];
        [person print];
        NSLog(@"Inherited Class Employee Object");
        Employee *employee = [[Employee alloc]initWithName:@"Raj" andAge:5 andEducation:@"MBA"];
        [employee print];
        [pool drain];
    }
Nitin
  • 31
  • 8

1 Answers1

0

You are using ARC mode ON code (Automatic Reference enabled), first you have to disable it via Xcode's settings, see below discussion:

How to enable/disable ARC in an xcode project?

bharat
  • 9
  • 1