jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

Warning about background execution on iOS when opening picker #70

Closed Naxos84 closed 4 years ago

Naxos84 commented 5 years ago

Describe the bug I'm having an nativescript-angular app. When I click a button inside my app i call a method to open the image picker. While the picker is opening in the app I get a warning:

(UIKitCore) [com.apple.UIKit:Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior. trace=(
0   UIKitCore                           0x000000010afe6932 kFixedAnimationDuration_block_invoke_5 + 107
1   libdispatch.dylib                   0x00000001079a7d02 _dispatch_client_callout + 8
2   libdispatch.dylib                   0x00000001079a94ce _dispatch_once_callout + 20
3   UIKitCore                           0x000000010afe68c5 +[UIView(Animation) setAnimationsEnabled:] + 76
4   UIKitCore                           0x000000010afe6a13 +[UIView(Animation) performWithoutAnimation:] + 84
5   UIKitCore                           0x000000010a284e9a -[UIVisualEffectView _updateSubviews] + 325
6   UIKitCore                           0x000000010a285caa -[UIVisualEffectView _configureAllEffects] + 1435
7   UIKitCore                           0x000000010a284139 -[UIVisualEffectView setBackgroundEffects:] + 396
8   UIKitCore                           0x000000010a28e242 -[_UIBarBackground updateBackground] + 229
9   UIKitCore                           0x000000010a28e4f1 -[_UIBarBackground transitionBackgroundViews] + 208
10  UIKitCore                           0x000000010a316c7e -[_UINavigationBarVisualProviderModernIOS _updateBackgrounds] + 850
11  UIKitCore                           0x000000010a316ec0 -[_UINavigationBarVisualProviderModernIOS layoutSubviews] + 272
12  UIKitCore                           0x000000010a2ccfa0 -[UINavigationBar layoutSubviews] + 256
13  UIKitCore                           0x000000010aff49c1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1417
14  UIKitCore                           0x000000010a2cccf8 -[UINavigationBar layoutSublayersOfLayer:] + 248
15  QuartzCore                          0x0000000105eb4eae -[CALayer layoutSublayers] + 173
16  QuartzCore                          0x0000000105eb9b88 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396
17  UIKitCore                           0x000000010afdf985 -[UIView(Hierarchy) layoutBelowIfNeeded] + 646
18  UIKitCore                           0x000000010a476585 -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 800
19  UIKitCore                           0x000000010a476804 -[UINavigationController _positionNavigationBarHidden:edge:] + 388
20  UIKitCore                           0x000000010a475ed1 -[UINavigationController setNavigationBar:] + 1410
21  UIKitCore                           0x000000010a47581e -[UINavigationController _navigationBarHiddenByDefault:] + 145
22  UIKitCore                           0x000000010a47d773 -[UINavigationController loadView] + 177
23  UIKitCore                           0x000000010a524048 -[UIViewController loadViewIfRequired] + 172
24  UIKitCore                           0x000000010a524868 -[UIViewController view] + 27
25  UIKitCore                           0x000000010a44c0fc -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
26  UIKitCore                           0x000000010a4401f2 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
27  UIKitCore                           0x000000010a5374ce -[UIViewController _presentViewController:withAnimationController:completion:] + 3700
28  UIKitCore                           0x000000010a53a11b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98
29  UIKitCore                           0x000000010a53a633 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
30  UIKitCore                           0x000000010a53a082 -[UIViewController _presentViewController:animated:completion:] + 172
31  UIKitCore                           0x000000010a53a2e0 -[UIViewController presentViewController:animated:completion:] + 150
32  NativeScript                        0x000000010335c40d ffi_call_unix64 + 85
33  ???                                 0x000000012c0d3030 0x0 + 5034029104
)

To Reproduce

I cannot share a complete repo to reproduce. but the provided sample code should be sufficient. (if not let me know so that I can strip this part into a separate repo....) To reproduce click the placeholder image.

Expected behavior When I click that image and the image picker is opening, there should be no warning about background execution. The plugin should handle UI related stuff in a consistent way.

NativeScript Info(please run tns info): tns info ✔ Getting NativeScript components versions information... ✔ Component nativescript has 5.4.0 version and is up to date. ✔ Component tns-core-modules has 5.4.1 version and is up to date. ✔ Component tns-android has 5.4.0 version and is up to date. ✔ Component tns-ios has 5.4.0 version and is up to date.

Sample Code(please provide minimum code to reproduce problem):

images.component.html

<StackLayout>
    <Image id="int_0" src="~/images/placeholder-image.png" stretch="fill" (tap)="openImagePicker($event)">
<StackLayout>

images.component.ts

openImagePicker(event: EventData): void {
        const clickedImage = event.object as Image;
        this.clickedImageId = clickedImage.id;
        console.log(this.clickedImageId + " Image clicked.");

        const imagePickerOptions: ImagePickerOptions = {
            android: {
                isCaptureMood: false,
                isNeedCamera: false,
                maxNumberFiles: 0,
                isNeedFolderList: false
            },
            ios: {
                isCaptureMood: false,
                maxNumberFiles: 0
            }
        };
        this.mediafilepicker.openImagePicker(imagePickerOptions);
        console.log("Opened mediafilepicker");
    }

Additional context

Agnostic commented 5 years ago

I have the same issue =/

vidhyasgr commented 5 years ago

I also have the same issue

codepotato commented 5 years ago

Same issue too on iOS simulator

marcocasadio commented 5 years ago

same issue for me (ns-vue app)

ITsvetkoFF commented 5 years ago

@jibon57 It seems that for Xcode 11.1 this is not a warning, but an error actually. So I was not able to build nativescript project with nativescript-mediafilepicker in Xcode 11.1

lukegeaves-ordapad commented 4 years ago

Same as @ITsvetkoFF our app crashes on iOS with Xcode 11.1 when we open the picker.

jibon57 commented 4 years ago

https://github.com/jibon57/nativescript-mediafilepicker/issues/88

LakshmiEvana commented 4 years ago

any update on this issue?i have the same issue please help me.

jacopo69 commented 4 years ago

same issue on iOS for me, any solution yet?