ryanlintott / LookingGlassUI

Shimmering SwiftUI Views using device orientation.
https://github.com/ryanlintott/LookingGlassUIExample
MIT License
300 stars 5 forks source link

Possible crash related to LookingGlassUI #2

Open rennarda opened 1 year ago

rennarda commented 1 year ago

Hi - I have incorporated your library into my app, but after doing so I saw a new class of crashes that have the following kind of stack trace:

Thread 19 Crashed:
0   libswiftCore.dylib              0x0000000181d03080 getCache(swift::TargetTypeContextDescriptor<swift::InProcess> const&) + 292 (Lazy.h:126)
1   libswiftCore.dylib              0x0000000181d03804 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 56 (Metadata.cpp:862)
2   libswiftCore.dylib              0x0000000181ce0e08 __swift_instantiateCanonicalPrespecializedGenericMetadata + 36 (<compiler-generated>:0)
3   SwiftUI                         0x000000018b50f454 AnimatorBox.value(in:for:) + 168 (Animation.swift:167)
4   SwiftUI                         0x000000018b48febc AnyAnimator.value(in:for:) + 156 (Animation.swift:116)
5   SwiftUI                         0x000000018b491564 DefaultCombiningAnimator.value(in:for:) + 688 (DefaultCombiningAnimation.swift:26)
6   SwiftUI                         0x000000018b50f454 AnimatorBox.value(in:for:) + 168 (Animation.swift:167)
7   SwiftUI                         0x000000018b48febc AnyAnimator.value(in:for:) + 156 (Animation.swift:116)
8   SwiftUI                         0x000000018b491564 DefaultCombiningAnimator.value(in:for:) + 688 (DefaultCombiningAnimation.swift:26)
9   SwiftUI                         0x000000018b50f454 AnimatorBox.value(in:for:) + 168 (Animation.swift:167)
10  SwiftUI                         0x000000018b48febc AnyAnimator.value(in:for:) + 156 (Animation.swift:116)
... and so in in an infinite loop

Crashes are spread across a range of iOS 15 and 16 versions and various devices.

I have not seen anything like this before. I was wondering if it looks like familiar? There's nothing in the trace to say it is LookingGlassUI doing this, but the timing of when the crashes started to happen is more than coincidental.

Any ideas?

ryanlintott commented 1 year ago

It's hard to tell from just a stack trace. Have you tried the example app to see if that works for you? Also, do you have some code you could share that shows how you've used it?

rennarda commented 1 year ago

I haven't had any problems personally, the effect works great for me and most users. It seems that about 8-10% of people see a crash at some point, most commonly immediately after launching or foregrounding the app. I wonder if it's something to do with the motion manager not immediately being available on launch.

I will look into providing some sample code tomorrow (GMT).