Crash on iOS when using Keyboard / Camera together by accident

Issue: When using keyboard and camera, the user will sometimes engage both by accident. This leads to an application crash. Encountered in Preview and Release builds on iOS.

Platform: iOS (at least)

Encountered in Fuse: Version 0.33-0.37

Package: Fuse.Camera

I’m uploading a tiny app that reproduces the issue:

Steps to reproduce

Click on the TextInput and then immediately click on the “Camera” button.

Possible Fix

I changed ImagePicker.m openImagePickerWithSourceType to this:

-(BOOL)openImagePickerWithSourceType:(UIImagePickerControllerSourceType)type then:(DictionaryAction)a or:(Action)or
{
	if([UIImagePickerController isSourceTypeAvailable:type])
	{
		self.onPicture = a;
		self.onCancel = or;
		_imagePicker = [[UIImagePickerController alloc] init];
		_imagePicker.sourceType = type;
		[_imagePicker setDelegate:self];
		dispatch_async(dispatch_get_main_queue(), ^{
			[[self VC] presentViewController:_imagePicker animated:YES completion:^{ }];
		});
		return YES;
	}else{
		return NO;
	}
}

The crash seems to go away if using async rather than presenting immediately.

Thanks for the report Mitesh! An internal ticket has been raised and you’ll get notified when we know more.