Xcode 中的记录设置:Swift 2.0

Record Settings in Xcode: Swift 2.0

这里是一段Swift2.0的代码,是我在教程(https://youtu.be/4qj1piMAPE0)中看到的。我在第一行收到错误:

Type of expression is ambiguous without more content.

import AVFoundation
import UIKit
...
var recordSettings = [AVFormatIDKey: kAudioFormatAppleLossless,
        AVEncoderAudioQualityKey: AVAudioQuality.Max.rawValue,
        AVEncoderBitRateKey: 320000,
        AVNumberOfChannelsKey: 2,
        AVSampleRateKey: 44100.0]

你可以试试:

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