我在Xcode 4.2中看到一个错误,它发布了alertsuccess。它说释放是不可用的,并且在自动引用计数模式下不可用,并且ARC禁止显式发送释放的消息。
我的应用程序和代码可以在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];
}发布于 2011-12-01 04:53:42
有了自动引用计数,你不应该再自己保留和释放对象了。
您可以在项目的构建设置中禁用ARC,也可以删除对-release的调用。
https://stackoverflow.com/questions/8077034
复制相似问题