Destination 'id <UINavigationControllerDelegate, UIImagePickerControllerDelegate>' from an incompatible type 'ViewController * const__strong'

I have an ImagePickerController in my application. It works well, but ipc.delegate = self;an error message appears next to it:

Assignment of 'I would' from an incompatible type 'ViewController * const__strong'

The application works well, so I ignored the error message, but I think I need to know why. Why is there an error message?

ipc = [[UIImagePickerController alloc]init];
            ipc.modalPresentationStyle = UIModalPresentationCurrentContext;
            ipc.delegate = self;
            ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            [ipc setAllowsEditing:NO];
            [self presentViewController:ipc animated:NO completion:nil];
+4
source share
2 answers

UIImagePickerController, :

@property(nonatomic, assign) id<UINavigationControllerDelegate, 
                                UIImagePickerControllerDelegate> delegate 

, ( self), UINavigationControllerDelegate UIImagePickerControllerDelegate. , .

, :

@interface MyViewController : UIViewController <UINavigationControllerDelegate, 
                                                UIImagePickerControllerDelegate>

, UINavigationControllerDelegate, UIImagePickerControllerDelegate.

+14

. , , <UINavigationControllerDelegate, UIImagePickerControllerDelegate>, , , , :

ipc.delegate = (id<<UINavigationControllerDelegate, UIImagePickerControllerDelegate>) self;

, , , . .

+2

All Articles