2011-11-10 68 views
0

我在[alertsuccess release]中得到了Xcode 4.2中的一个错误。它表示版本不可用,并且在自动引用计数模式下不可用,并且ARC禁止发布发布的明确消息。[alertsuccess release]; xcode 4.2

我的应用和代码在Xcode 4.1中工作。哪里不对?

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

可能的重复[编译时ARC错误](http://stackoverflow.com/questions/7164848/arc-error-when-compiling) – 2011-11-10 09:06:09

回答

0

使用自动引用计数,你不应该保留和释放对象了。

您可以在项目的构建设置中禁用ARC,也可以将您的呼叫移至-release。