I am just starting out in iOS development, so for my first project, I'm developing a simple iOS application to take a picture and display it on the screen.
Here's my code, it's on line four that I get the error:
- (IBAction)takePicture:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
}
I get the following warning:
Assigning to 'id<UINavigationControllerDelegate,UIImagePickerControllerDelegate>' from incompatible type 'todd_learningViewController *const __strong'
I don't understand the warning message and don't know how to get rid of the warning.
Thanks,
EDIT:
My header file for the class looks like this:
@interface todd_learningViewController : UIViewController <UIApplicationDelegate>
- (IBAction)takePicture:(id)sender;
@property (weak, nonatomic) IBOutlet UIImageView *pictureView;
@end
How should I modify it?
Make your class implement UINavigationControllerDelegate
and this warning message will go away. All the methods in this protocol are optional so you will not have to modify your implementation class.
Why we have to do this is still something I am trying to figure out but for now this is the solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With