Skip to content

Force close browse gallery picker images #293

Answered by yasirkula
levanhoangvu asked this question in Q&A
Discussion options

You must be logged in to vote

I think the native iOS source code (NativeGallery.mm) could be modified to achieve this:

To the top:

+ (void)closeMediaPicker;

To the middle:

+ (void)closeMediaPicker
{
	if( imagePicker != nil )
		[imagePicker dismissViewControllerAnimated:NO completion:nil];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
	else if( CHECK_IOS_VERSION( @"14.0" ) && imagePickerNew != nil )
		[imagePickerNew dismissViewControllerAnimated:NO completion:nil];
#endif
}

To the bottom:

extern "C" void _NativeGallery_CloseMediaPicker()
{
	[UNativeGallery closeMediaPicker];
}

In C#:

#if !UNITY_EDITOR && UNITY_IOS
[System.Runtime.InteropServices.DllImport( "__Internal" )]
private static extern void _NativeGallery_Clos…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@levanhoangvu
Comment options

@yasirkula
Comment options

@levanhoangvu
Comment options

Answer selected by yasirkula
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants