scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash due to the use of method swizzling

nalexn opened this issue · comments

Description

We've recently started getting random crashes with the following stack:

Crashed: com.apple.main-thread
0   libobjc.A.dylib                0x2224 cache_getImp + 132
1   libobjc.A.dylib                0x1057c cache_t::shouldFlush(objc_selector*, void (*)()) const + 64
2   libobjc.A.dylib                0xc668 invocation function for block in flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 32
3   libobjc.A.dylib                0xd534 flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 296
4   libobjc.A.dylib                0x1c6b8 _method_setImplementation(objc_class*, method_t*, void (*)()) + 224
5   libobjc.A.dylib                0x19da4 method_setImplementation + 96
6   myapp                          0x5b97ec one-time initialization function for dismissSwizzling + 647 (FloatingPanelController.swift:647)
7   libdispatch.dylib              0x64094 _dispatch_client_callout + 16
8   libdispatch.dylib              0x34bf8 _dispatch_once_callout + 28
9   myapp                          0x5b6c98 FloatingPanelController.setUp() + 641 (FloatingPanelController.swift:641)
10  myapp                          0x5b9fa0 specialized FloatingPanelController.init(delegate:) + 4317159328 (<compiler-generated>:4317159328)
11  myapp                          0x5b6a68 FloatingPanelController.init(delegate:) + 4317145704 (<compiler-generated>:4317145704)

Expected behavior

No crash

Actual behavior

A random crash

Steps to reproduce

I believe we've started seeing this crash after adding other libraries that also do swizzling. While this is understandable for SDKs like analytics to do the swizzling, I believe the libraries like this should refrain from using it. Please explore less hacky alternatives.

How do you display panel(s)?

  • Add as child view controllers

How many panels do you displays?

  • 1

Environment

Library version

1.7.6

Installation method

SPM

iOS version(s)

iOS 16.4

Xcode version

14.3

In v2.6.3, the swizzling implementation has been updated for cases where it is used with the analysis library. I would like you to try the version and please give me a feedback.