【问题标题】:Bad receiver type 'AVMediaType' in Objective-CObjective-C 中的错误接收器类型“AVMediaType”
【发布时间】:2018-02-26 08:37:08
【问题描述】:

我目前正在为一个已经存在的项目开发相机视图。当我运行应用程序时,我的应用程序出现错误。主要问题是我在运行项目时遇到错误。该错误类似于带有 AVMediaTypeVideo 的 mediaType。你可以看到here

我尝试了不同的选项,发现 AVFoundation 发生了一些变化。

下一个问题与第一个问题有关,因为我在右上角使用 AVFoundation 来实现我的相机,我有一条红色的错误消息,描述为图像here

不管你有哪种语言的解决方案,Siwft 和 Objective-C 都可以。

如果有人对此问题有所了解,请在此处分享,我们将不胜感激。

谢谢!

【问题讨论】:

  • 请发布代码而不是代码截图。

标签: ios objective-c swift avfoundation avcapturesession


【解决方案1】:

你的代码对我来说很好。

AVCaptureConnection *connection = [_movieFileOutput connectionWithMediaType:AVMediaTypeAudio];

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

退出 Xcode 并再次运行。

【讨论】:

  • 嘿@technerd 我和我的团队在一个与您在此处发布的问题非常相似的问题上花费了数小时。你有机会快速浏览一下吗?啊,我们很沮丧。 :stackoverflow.com/questions/49235811/…
猜你喜欢
  • 2017-02-10
  • 2017-10-25
  • 2019-11-27
  • 1970-01-01
  • 2017-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-19
相关资源
最近更新 更多