Ios5 使用警报对话框时出错

Ios5 使用警报对话框时出错,ios5,xcode4,uialertview,Ios5,Xcode4,Uialertview,接收到“UIAlertView的无可见@interface声明选择器‘message:delegate:otherButtonTitles’”。我试图设置一个2按钮警报对话框,在用户选择图像后显示。我在.h文件中有一个。以下是带有警报对话框的图像拾取代码: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

接收到“UIAlertView的无可见@interface声明选择器‘message:delegate:otherButtonTitles’”。我试图设置一个2按钮警报对话框,在用户选择图像后显示。我在.h文件中有一个。以下是带有警报对话框的图像拾取代码:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [[UIApplication sharedApplication]setStatusBarHidden:YES];
    [self dismissModalViewControllerAnimated:YES];
    UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
    NSData *imageData = UIImagePNGRepresentation(originalImage);
    NSString* imageName = @"yourPhoto.png";
    NSString* paths = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
    NSString* fullPathToFile = [paths stringByAppendingPathComponent:imageName];
    [imageData writeToFile:fullPathToFile atomically:NO];

UIAlertView *dir;
dir = [[[UIAlertView alloc]
        message:@"Choose the direction."
        delegate:self
        otherButtonTitles:@"Left",@"Right",nil];
[dir show];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [self dismissModalViewControllerAnimated:YES];
}

错误显示在“dir=[[UIAlertView alloc]行上。有人能帮我解释为什么会出现此错误以及如何修复它吗?谢谢。

我已经解决了。似乎您必须在警报对话框中显示消息:@“string”和取消按钮:@“string”