Swift 2.0:没有更多上下文,表达式是不明确的? [英] Swift 2.0: Type of Expression is ambiguous without more context?

查看:240
本文介绍了Swift 2.0:没有更多上下文,表达式是不明确的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下用于在Swift 1.2中工作:

The following used to work in Swift 1.2:

var recordSettings = [
    AVFormatIDKey: kAudioFormatMPEG4AAC,
    AVEncoderAudioQualityKey : AVAudioQuality.Max.rawValue,
    AVEncoderBitRateKey : 320000,
    AVNumberOfChannelsKey: 2,
    AVSampleRateKey : 44100.0]

现在,它给出错误:


没有更多上下文,类型表达式是不明确的。

"Type expression is ambiguous without more context".


推荐答案

您可以为编译器提供更多信息:

You could give the compiler more information:

let recordSettings : [String : Any] =
[
    AVFormatIDKey: kAudioFormatMPEG4AAC,
    AVEncoderAudioQualityKey : AVAudioQuality.Max.rawValue,
    AVEncoderBitRateKey : 320000,
    AVNumberOfChannelsKey: 2,
    AVSampleRateKey : 44100.0
]

这篇关于Swift 2.0:没有更多上下文,表达式是不明确的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆