iOS7中的警报视图

时间:2014-01-06 15:39:29

标签: ios ios7

我是iOS和Objective C的新手。我有以下代码在iOS7中为iPhone应用程序创建警报视图:

if ([tracker exceededGoal]){
    [UIAlertView] *alert = [[UIAlertView alloc] initWithTitle:@"Done" message:@"You acheived your goal!" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];

}

我收到以下错误:

  

使用未声明的标识符'alert'

     

预期标识符

我做错了什么?

1 个答案:

答案 0 :(得分:6)

在此处删除括号:UIAlertView *alert =