Post

Replies

Boosts

Views

Activity

Reply to Request authorization for the notification center crash iOS app on Swift 6
I can attest that AVCaptureDevice.requestAccess suffered from this same problem, i.e. crashing with a thread/queue violation when built under Swift 6. Original code: AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { granted in if (granted) { DispatchQueue.main.async { [weak self] in // do something } } }) Modified code: Task { let granted = await AVCaptureDevice.requestAccess(for: .video) if (granted) { Task { @MainActor in // do something } } } This code pops a permission dialog for using the camera, and as soon as the Allow button is clicked the app would crash.
Nov ’24