Mike Flynn
Mike Flynn

Reputation: 24325

UIAlertView and releasing object after showing it

I am reviewing some source code and noticed this method below. It isn't releasing the message after allocating it. Shouldn't there be a [message release]; after the show?

- (void)service:(TestService*)service didFailWithError:(NSObject *)error
{
    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Service Error"
                                                message:errorMsg
                                                delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil];

    [message show];
}

Upvotes: 0

Views: 75

Answers (1)

Scott Berrevoets
Scott Berrevoets

Reputation: 16946

If ARC wasn't enabled, then yes, release should have been called after show.

Upvotes: 4

Related Questions