简体   繁体   English

Objective-C中错误的接收器类型“ AVMediaType”

[英]Bad receiver type 'AVMediaType' in Objective-C

I am currently working on Camera View for a project which is already exist. 我目前正在为一个已经存在的项目使用Camera View。 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. 该错误类似于带有AVMediaTypeVideo的mediaType。 You can see here . 你可以在这里看到。

在此处输入图片说明

I tried different options and I found that there is some changes in AVFoundation. 我尝试了其他选项,但发现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 . 因为我现在用的是AVFoundation我在右上角的相机实现我描述为图像中的红色的错误消息,接下来的问题是关系到第一位置

在此处输入图片说明

It does not matter which language you have solution, it can be both Siwft and Objective-C. 不管您使用哪种语言,都可以使用Siwft和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. 退出Xcode,然后再次运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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