简体   繁体   中英

Bad receiver type 'AVMediaType' in Objective-C

I am currently working on Camera View for a project which is already exist. My app is giving an error when I run the app. The main problem is that I am getting errors while running the project. The error is like mediaType with AVMediaTypeVideo. You can see here .

在此处输入图片说明

I tried different options and I found that there is some changes in AVFoundation.

The next problem is related to the first since I am using the AVFoundation for my camera implementation on the top right corner I have a red error message which describes as in the image here .

在此处输入图片说明

It does not matter which language you have solution, it can be both Siwft and Objective-C.

If someone know anything about this issue please share it here and it would be very appreciated.

Thanks!

Your code working fine for me.

AVCaptureConnection *connection = [_movieFileOutput connectionWithMediaType:AVMediaTypeAudio];

for (AVCaptureInputPort *port in [connection inputPorts]) {
    if ([[port mediaType] isEqual:AVMediaTypeVideo]){
        NSLog(@"Media is Video type");
    }
}

Quit the Xcode and run again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM