AVAudioRecorder init crash

Originator:pzabelin
Number:rdar://FB7677561 Date Originated:04/26/2020
Status:open Resolved:
Product:iOS SDK Product Version:13.4
Classification:Bug Reproducible:always
 
AVAudioRecorder.init(url:settings:) crashes instead of throwing an error.

See the example project: https://github.com/paulz/CrashInAVAudioRecorderInit/blob/master/CrashInAVAudioRecorderInitTests/CrashInAVAudioRecorderInitTests.swift#L27

Steps to reproduce:

1. Open project in Xcode
2. Run Tests
3. Notice 2 passing tests for successful and error cases
4. Notice crash in test3ExpectingNilActualCrash

Comments

Code snippet demonstrating the problem

    let invalidUrlCausingCrash = URL(string: "mailto:bugreport@apple.com")!
    let recorder = try? AVAudioRecorder(url: invalidUrlCausingCrash, settings: [:])

// Causing crash: *** CFEqual() called with NULL first argument ***
// in CFEqual.cold.1 ()
// Expecting throw error instead of a crash

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!