2013-02-18 42 views
0

我正在審查一些源代碼,並注意到下面的這個方法。它在分配後不會釋放message。節目後不應該有[message release];UIAlertView並顯示它後釋放對象

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

    [message show]; 
} 

回答

4

如果ARC沒有啓用,那麼是的,釋放應該在show之後被調用。