ios - 将 Int 转换为 CMAttachmentMode

标签 ios swift casting

我一直收到错误“Int not convertible to CMAttachmentMode”。我不确定我应该如何转换这个变量才能让它在我的 CFDictionaryRef 中工作。如果有人可以解释,我将不胜感激。谢谢!

var attachmentMode = kCMAttachmentMode_ShouldPropagate as CMAttachmentMode
var attachments:CFDictionaryRef = CMCopyDictionaryOfAttachments(kCFAllocatorDefault, sampleBuffer, attachmentMode)

最佳答案

var attachmentMode = CMAttachmentMode(kCMAttachmentMode_ShouldPropagate)
var attachments:CFDictionaryRef = CMCopyDictionaryOfAttachments(kCFAllocatorDefault, sampleBuffer, attachmentMode)

关于ios - 将 Int 转换为 CMAttachmentMode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29340476/

相关文章:

ios - 如何在IOS中创建选择器 View 来选择几个日期

php - 如何测量客户端和服务器之间使用的网络带宽?

javascript - 将值从 iOS 传递到 uiWebView

java - 在 Java 8 流中转换类型

ios - 转换 [字符串 : Any] to [String: String] in swift

android - BLE 4.0/4.1 支持Android 64字节数据传输

iphone - 关于如何设置 Storyboard以使元素不重叠的建议

ios - Swift - 仅解码感兴趣的元素

ios - 如果另一个模型中存在值,则更新模型的属性

c# - 解释一下这种类型的转换?