[AVAssetWriter addInput:] Format ID 'lpcm' is not compatible with file type com.apple.m4a-audio

This is the crash log from Firebase.

Fatal Exception: NSInvalidArgumentException
*** -[AVAssetWriter addInput:] Format ID 'lpcm' is not compatible with file type com.apple.m4a-audio

But I can't reproduce the crash ... This is the demo code Does anyone know where the problem is ?

 let normalOutputSettings:[String:Any] = [
    AVFormatIDKey : kAudioFormatLinearPCM,
    AVSampleRateKey : 44100,
    AVNumberOfChannelsKey : 2,
    AVLinearPCMBitDepthKey : 16,
    AVLinearPCMIsNonInterleaved : false,
    AVLinearPCMIsFloatKey : false,
    AVLinearPCMIsBigEndianKey : false
  ]

let writerInput = AVAssetWriterInput(mediaType: .audio, outputSettings: outputSettings)

let outputURL = URL(fileURLWithPath: NSTemporaryDirectory() + UUID().uuidString + ".m4a")

self.writer = try! AVAssetWriter(outputURL: outputURL, fileType: fileType)

writer?.add(writerInput)
[AVAssetWriter addInput:] Format ID 'lpcm' is not compatible with file type com.apple.m4a-audio
 
 
Q