Swift 2.0: Type of Expression is ambiguous without more context?

后端 未结 3 436
说谎
说谎 2020-12-30 20:32

The following used to work in Swift 1.2:

var recordSettings = [
    AVFormatIDKey: kAudioFormatMPEG4AAC,
    AVEncoderAudioQualityKey : AVAudioQuality.Max.ra         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-30 21:16

    I also got this error message trying to initialise an array of optionals with nil:

    var eggs : [Egg] = Array(count: 10, repeatedValue: nil)
    

    Expression Type 'Array' is ambiguous without more context.

    Changing [Egg] to [Egg?] fixed the error.

提交回复
热议问题