0

I get an error in Xcode 4.2 with [alertsuccess release]. It says the release is unavailable and not available in automatic reference counting mode, and ARC forbids explicit message send of release.

My app and code works in Xcode 4.1. What is wrong?

    if([serverOutput isEqualToString:@"Yes"]){


    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Congrats" message:@"You are authorized "
                                                          delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

    [alertsuccess show];
    [alertsuccess release];




} else {
    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Username or Password Incorrect"
                                                          delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alertsuccess show];
    [alertsuccess release];

}
  • 1
    possible duplicate of [ARC error when compiling](http://stackoverflow.com/questions/7164848/arc-error-when-compiling) –  Nov 10 '11 at 09:06

1 Answers1

0

With Automatic Reference Counting, you're not supposed to retain and release objects yourself anymore.

You can disable ARC in Build Settings of your project, or you can remove your calls to -release.

Pang Zi Yang
  • 95
  • 1
  • 1
  • 5
StilesCrisis
  • 15,972
  • 4
  • 39
  • 62