I keep getting an unused variable warning. I’m trying to have a modal view appear, where a user selects a photo, and I want to use that selected image in an UIImageView.
Not sure if this is enough info but would really appreciate any help.
- (IBAction) buttonPressed:(UIButton *)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void) imagePickerController:( UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info {
UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage];
}
you’re getting the warning because you’re not using the image object anymore. You must save this image in some class object to use it somewhere in the code, warning will automatically vanish if you do that. Or just for removing the warning you can do: