我目前正在为一个已经存在的项目开发相机 View 。我的应用程序在运行时出错。主要问题是我在运行项目时遇到错误。该错误类似于带有 AVMediaTypeVideo 的 mediaType。可以看到here .
我尝试了不同的选项,发现 AVFoundation 有一些变化。
下一个问题与第一个问题有关,因为我在右上角使用 AVFoundation 实现我的相机,我有一条红色错误消息,如图所示 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/