Hi, I am creating an app in compose multiplatform ...
# ios
r
Hi, I am creating an app in compose multiplatform where i need to capture image from camera. I am able to launch camera using UIImagePickerController. Camera is launched but when i click Use photo after capturing image, app restarts and i can only see the error
<0x101f0bbb0> Gesture: System gesture gate timed out.
Unknown chipRevisionID (0xffffffff)
Attempted to change to mode Portrait with an unsupported device (BackWideDual). Auto device for both positions unsupported, returning Auto device for same position anyway (BackAuto).
My Actual iOS implementation is like this
if (UIImagePickerController.isCameraDeviceAvailable(UIImagePickerControllerCameraDevice._UIImagePickerControllerCameraDeviceRear_)) {
val imagePickerController = UIImagePickerController()._apply_ *{*
sourceType =
UIImagePickerControllerSourceType._UIImagePickerControllerSourceTypeCamera_
cameraDevice =
UIImagePickerControllerCameraDevice._UIImagePickerControllerCameraDeviceRear_
cameraCaptureMode =
UIImagePickerControllerCameraCaptureMode._UIImagePickerControllerCameraCaptureModePhoto_
allowsEditing = false
delegate = object : NSObject(), UIImagePickerControllerDelegateProtocol,
UINavigationControllerDelegateProtocol {
override fun imagePickerController(
picker: UIImagePickerController,
didFinishPickingMediaWithInfo: Map<Any?, *>
) {
try {
val image =
didFinishPickingMediaWithInfo[_UIImagePickerControllerOriginalImage_] as UIImage
capturedImage.value = image._toBytes_()
picker.dismissViewControllerAnimated(true, null)
val filePath = _saveImageToLocalFile_(image = image)
_println_("Saved filePath: $filePath")
} catch (e: Exception) {
_println_("Error: ${e.message}")
}
}
override fun imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.dismissViewControllerAnimated(true, null)
}
}
}
UIApplication.sharedApplication.keyWindow?.rootViewController?.presentViewController(
imagePickerController,
true,
null
)
} else {
_println_("Camera is not available, so setting for gallery")
}
Pls let me know if anyone has solution for this
230 Views