We use several UIKit and AVFoundation APIs in our project, including:
- setAlternateIconName(_:completionHandler:)
- getAllTasks(completionHandler:)
- loadMediaSelectionGroup(for:completionHandler:)
Moreover, we use the Swift Concurrency versions for these APIs:
@MainActor
func setAlternateIconName(_ alternateIconName: String?) async throws
var allTasks: [URLSessionTask] { get async }
func loadMediaSelectionGroup(for mediaCharacteristic: AVMediaCharacteristic) async throws -> AVMediaSelectionGroup?
Everything worked well with these APIs in Xcode 16.2 and earlier, but starting from Xcode 16.3 (and in 16.4), they cause crashes. We've rewritten the APIs to use completion blocks instead of async/await, and this approach works.
Stack traces:
Also, I attached some screenshots from Xcode 16.4.
You’ve described three different failures, but each of them in limited detail. I’d like to focus on one case and then dig deeper into that case. Because I’m a Networking Guy™, I chose your second case (-:
Here’s what I did:
-
On macOS 15.5, using Xcode 16.4, I created a new project from the iOS > App template.
-
I added this code to the main view:
Button("Test") { Task { print(await URLSession.shared.allTasks) } }
-
I built and ran it on the iOS 18.5 simulator, and then clicked the button. It didn’t crash.
-
I built and ran it on the iOS 18.5 device, and then tapped the button. It didn’t crash.
I’m not sure why it’s crashing for you. I recommend that you repeat the above process. That’ll tell us whether you have an environmental issue, or it’s something specific to your main project.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"