Aespa
Aespa copied to clipboard
Possible SWIFT TASK CONTINUATION MISUSE exception in AespaCoreCamera.capture
In my app, when the user takes multiple photos in rapid succession, the following error is triggered in line 46 of AespaCoreCamera.capture:
Thread 1: Fatal error: SWIFT TASK CONTINUATION MISUSE: capture(setting:autoVideoOrientationEnabled:) tried to resume its continuation more than once, returning <AVCapturePhoto: 0x303ba3f00 pts:288826.435876 1/1 settings:uid:6 photo:{1280x720} time:0.276-0.369>!
I'm still new to Swift and to Aespa but wanted to document here. It's very possible that my code is misusing continuations. Here's the code I'm using to invoke Aespa:
aespaSession.capturePhoto(autoVideoOrientationEnabled: true, { (result) -> Void in
Task(priority: .userInitiated) {
switch result {
case .success(let photoFile):
await self.saveImage(image: photoFile.image, creationDate: photoFile.creationDate)
case .failure(let error):
logger.error("Unable to capture photo: \(error)")
self.processCaptureFailure(error)
}
}
})
If I can confirm the issue is with Aespa and not my code I will try to come up with a fix
Hey @subelsky, I'm getting the same issue when tapping the capture button really fast. Did you manage to find a fix for this? I wonder if we can just disable the button when the user clicks on the capture button and then enable it again once a photo has been captured?
@missphyrgames yup that's what I did, works well
I get this if I stop recording for the first time, even if the "Stop" button is pressed after a couple of seconds:
SWIFT TASK CONTINUATION MISUSE: stopRecording() leaked its continuation!
Subsequent calls work without error.
Just wanted to add that I also see this issue if I capture media in quick succession. It crashes the whole app.