Force close browse gallery picker images #293
Answered
by
yasirkula
levanhoangvu
asked this question in
Q&A
-
Hi, could we force close browse gallery picker images in code unity? |
Beta Was this translation helpful? Give feedback.
Answered by
yasirkula
Aug 24, 2023
Replies: 1 comment 3 replies
-
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_CloseMediaPicker();
#endif
void X()
{
_NativeGallery_CloseMediaPicker();
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
yasirkula
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the native iOS source code (NativeGallery.mm) could be modified to achieve this:
To the top:
+ (void)closeMediaPicker;
To the middle:
To the bottom:
In C#: