Receiving "No visible @interface for UIAlertView declares the selector 'message:delegate:otherButtonTitles'". I'm trying to set an 2 button alert dialog to show after the user chooses an image. I have in the .h file UIAlertDelegate. Here is the image picking code with the alert dialog:
- (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];
}
The error show on the line "dir = [[UIAlertView alloc]. Can anyone help me out on why I'm getting this error and how to fix it? Thank you.
I got it figured out. It seems you must have the message:@"string" and the CancelButtonTitle:@"string" in the alert dialog.