LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 342 forks source link

App crashes in iOS 13.1.2 #365

Closed tarunbhutani closed 5 years ago

tarunbhutani commented 5 years ago

App is working fine when running from local system but it got rejected from App Store as the app is crashing. I've debug though the crashlog and found this issue.

Last Exception Backtrace:
0   CoreFoundation                  0x18773c98c __exceptionPreprocess + 220 (NSException.m:199)
1   libobjc.A.dylib                 0x1874650a4 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                  0x187632054 +[NSException raise:format:] + 108 (NSException.m:155)
3   UIKitCore                       0x18b3a609c -[UIImage size] + 104 (UIImage.m:1743)
4   UIKitCore                       0x18af0ccd0 -[UIToolbar setBackgroundImage:forToolbarPosition:barMetrics:] + 232 (UIToolbar.m:764)
5   UIKitCore                       0x18b366bf8 TaggingAppearanceGeneralSetterIMP + 124
6   LNPopupController               0x105b3d8f8 -[LNPopupBar initWithFrame:] + 548 (LNPopupBar.m:206)
7   LNPopupController               0x105b32840 -[LNPopupController popupBarStorage] + 104 (LNPopupController.m:1060)
8   LNPopupController               0x105b46ae4 -[UIViewController(LNPopupSupport) popupBar] + 48 (UIViewController+LNPopupSupport.m:139)

Breaking code

tabBarController.popupBar.customBarViewController = miniPlayerViewController

Device, OS and Xcode Versions

Xcode: 11.0, OS: 13.1.2

LeoNatan commented 5 years ago

Looks like you are using an old version of the framework?

LeoNatan commented 5 years ago

Do you have the exception details?

tarunbhutani commented 5 years ago

Thanks for your response. I've only this exception log from crash log file.

Date/Time:           2019-10-12 07:03:25.2336 +0800
Launch Time:         2019-10-12 07:03:24.1454 +0800
OS Version:          iPhone OS 13.1.2 (17A861)
Release Type:        User
Baseband Version:    5.00.01
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x18773c98c __exceptionPreprocess + 220 (NSException.m:199)
1   libobjc.A.dylib                 0x1874650a4 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                  0x187632054 +[NSException raise:format:] + 108 (NSException.m:155)
3   UIKitCore                       0x18b3a609c -[UIImage size] + 104 (UIImage.m:1743)
4   UIKitCore                       0x18af0ccd0 -[UIToolbar setBackgroundImage:forToolbarPosition:barMetrics:] + 232 (UIToolbar.m:764)
5   UIKitCore                       0x18b366bf8 TaggingAppearanceGeneralSetterIMP + 124
6   LNPopupController               0x105b3d8f8 -[LNPopupBar initWithFrame:] + 548 (LNPopupBar.m:206)
7   LNPopupController               0x105b32840 -[LNPopupController popupBarStorage] + 104 (LNPopupController.m:1060)
8   LNPopupController               0x105b46ae4 -[UIViewController(LNPopupSupport) popupBar] + 48 (UIViewController+LNPopupSupport.m:139)
9   Demo                            0x10431e894 PlayerCoordinator.start() + 260 (PlayerCoordinator.swift:25)
Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000187534ebc __pthread_kill + 8
1   libsystem_pthread.dylib         0x0000000187454c1c pthread_kill$VARIANT$armv81 + 192 (pthread.c:1456)
2   libsystem_c.dylib               0x00000001873a4824 abort + 100 (abort.c:110)
3   libc++abi.dylib                 0x00000001874fd7d4 abort_message + 128 (abort_message.cpp:76)
4   libc++abi.dylib                 0x00000001874fd9c4 demangling_terminate_handler() + 296 (cxa_default_handlers.cpp:66)
5   libobjc.A.dylib                 0x0000000187465358 _objc_terminate() + 124 (objc-exception.mm:701)
6   libc++abi.dylib                 0x000000018750a304 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib                 0x0000000187509c58 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 32 (cxa_exception.cpp:153)
8   libc++abi.dylib                 0x0000000187509c18 __cxa_throw + 124 (cxa_exception.cpp:285)
9   libobjc.A.dylib                 0x00000001874651d0 objc_exception_throw + 356 (objc-exception.mm:591)
10  CoreFoundation                  0x0000000187632054 +[NSException raise:format:] + 108 (NSException.m:155)
11  UIKitCore                       0x000000018b3a609c -[UIImage size] + 104 (UIImage.m:1743)
12  UIKitCore                       0x000000018af0ccd0 -[UIToolbar setBackgroundImage:forToolbarPosition:barMetrics:] + 232 (UIToolbar.m:764)
13  UIKitCore                       0x000000018b366bf8 TaggingAppearanceGeneralSetterIMP + 124
14  LNPopupController               0x0000000105b3d8f8 -[LNPopupBar initWithFrame:] + 548 (LNPopupBar.m:206)
15  LNPopupController               0x0000000105b32840 -[LNPopupController popupBarStorage] + 104 (LNPopupController.m:1060)
16  LNPopupController               0x0000000105b46ae4 -[UIViewController(LNPopupSupport) popupBar] + 48 (UIViewController+LNPopupSupport.m:139)
LeoNatan commented 5 years ago

What version are you using?

tarunbhutani commented 5 years ago

V2.8.4

LeoNatan commented 5 years ago

I'm looking in the code, and it doesn't seem related to LNPopupController. The framework initializes a new toolbar, and some UIAppearance methods are called.

Do you perhaps have somewhere in your code appearance code to set a background image for toolbars? That's what it looks like.

LeoNatan commented 5 years ago

https://developer.apple.com/documentation/uikit/uiappearance

LeoNatan commented 5 years ago

Put a breakpoint in some of those methods and investigate who and where it is done in your code.

jmartinesp commented 4 years ago

I'm seeing the same stacktrace when I try to present the popupbar using presentPopupBarWithContentViewController, when LNPopupBar is instantiated. I can confirm that I don't use any UIAppearance methods anywhere. I already tried updating to 2.8.5.

The app I'm working on is getting rejected because of this issue but I can't reproduce it myself neither on a real device nor on a simulator... I wish I could be more helpful.

jmartinesp commented 4 years ago

Actually, I wasn't using the most recent version. I inherited this project with almost 0 documentation and I just realised that they are using Carthage for a single dependency... this lib. When building for simulator / devices it used the right version (2.8.5), but when I archived the app, the old sources were downloaded through Carthage and they replaced the local version.

LeoNatan commented 4 years ago

That makes sense. It was a problem in older versions on iOS 13.

I would suggest using git submodule as dependency for this. It is the easiest way to maintain.