简体   繁体   English

iOS Swift CoreMedia CMFormatDescriptionRef链接器错误

[英]ios swift CoreMedia CMFormatDescriptionRef linker error

I'm trying to read a format descriptor from one of my AVAssetTrack's with the following code: 我正在尝试使用以下代码从我的AVAssetTrack之一读取格式描述符:

var audioTrack:AVAssetTrack = self.asset!.tracksWithMediaType(AVMediaTypeAudio)[0] as AVAssetTrack
var formatDescription:CMFormatDescriptionRef = audioTrack.formatDescriptions[0] as CMFormatDescriptionRef

The problem is the downcast "as CMFormatDescriptionRef". 问题是垂头丧气的“作为CMFormatDescriptionRef”。 I can declare a variable with type CMFormatDescriptionRef just fine but with the downcast I'm getting a linker error despite having added the CoreMedia framework and an "import CoreMedia" in my swift file. 我可以用CMFormatDescriptionRef类型声明一个变量,但是随着向下转换,尽管在我的swift文件中添加了CoreMedia框架和“ import CoreMedia”,但我还是收到链接器错误。 This is the linker error I get: 这是我得到的链接器错误:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_CMFormatDescription", referenced from:

Any help would be appreciated. 任何帮助,将不胜感激。

您需要将您的项目与CoreMedia.framwork链接。

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

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