ios - Objective-C 中错误的接收器类型 'AVMediaType'

标签 ios objective-c swift avfoundation avcapturesession

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

enter image description here

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

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

enter image description here

无论您使用哪种语言解决方案,Siwft 和 Objective-C 都可以。

如果有人对这个问题有任何了解,请在这里分享,我们将不胜感激。

谢谢!

最佳答案

你的代码对我来说工作正常。

AVCaptureConnection *connection = [_movieFileOutput connectionWithMediaType:AVMediaTypeAudio];

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

退出 Xcode 并再次运行。

关于ios - Objective-C 中错误的接收器类型 'AVMediaType',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48984345/

相关文章:

ios - 查找IOS中柑橘支付集成问题

swift - 如何使用 CLLocation 根据彼此之间的距离来显示 Firebase 用户/排名?

Swift 无法编辑 UITextView 并且无法添加文本

objective-c - 更改单元格内的 UIButton 图像

objective-c - NSDictionary 类的 JSONRepresentation 如何工作?

swift - 无法在 TableCellView 中初始化 UIImage

ios - 如何使用 segue 为 Facebook iOS Friend Picker 自定义背景和单元格?

iphone - 将数据传回前一个 View Controller

ios - 导航 Controller 按钮问题

ios - 为什么 viewDidAppear 没有调用?