-
-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Labels
Description
Prerequisites
- [/] I checked the documentation and found no answer
- [/] I checked to make sure that this issue has not already been filed
Expected Behavior
When taking multiple subsequent images, onImageCaptured
gets called and i can access the captured image without any issues.
Current Behavior
With the following code:
struct CameraSandbox: View {
@State var captureImage: UIImage?
@State var displayImage: Bool = false
var body: some View {
ZStack {
MCamera()
.setAudioAvailability(false)
.setErrorScreen(CustomErrorScreen.init)
.setCapturedMediaScreen(nil) // Disable captured media screen
.setCameraScreen(CustomCameraScreen.init)
.onImageCaptured { (image, controller) in
captureImage = image
controller.reopenCameraScreen()
}
.startSession() // Start the camera session
}
.onChange(of: captureImage) {
displayImage = captureImage != nil
}
.sheet(isPresented: $displayImage) {
if let captureImage {
Image(uiImage: captureImage)
.resizable()
.scaledToFit()
}
}
}
}
The first attempt results in the image correctly displayed in the sheet, and the second attempt consistently results in a crash at MijickCamera/CameraManager+PhotoOutput.swift:45:
settings.flashMode = parent.attributes.flashMode.toDeviceFlashMode()
With parent
being nil
If i comment out captureImage = image
in my onImageCaptured
handler, camera sound and animation plays without crash.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Create a camera screen with the captured media screen disabled and custom camera screen
- Specify
onImageCaptured
and try to store the result image - Take subsequent images from the camera screen
- Observe crash
Code Sample
See above
Screenshots
N/A
Context
Name | Version |
---|---|
SDK | e.g. 3.0.2 |
Xcode | Version 16.2 (16C5032a) |
Operating System | e.g. iOS 18.3.2 |
Device | e.g. iPhone XS |
hinathan