Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-[FloatingPanel.FloatingPanelController _setContentSizeNotificationToken:]: unrecognized selector sent to instance #206

Closed
1 of 3 tasks
Isuru-Nanayakkara opened this issue May 17, 2019 · 10 comments

Comments

@Isuru-Nanayakkara
Copy link

Isuru-Nanayakkara commented May 17, 2019

Short description

I updated from v1.4.0 to 1.5.1 and did no changes to the existing code and I get the below runtime error.

-[FloatingPanel.FloatingPanelController _setContentSizeNotificationToken:]: unrecognized selector sent to instance

Actual behavior

App crashes at the line where I set the contentViewController.

Steps to reproduce

let passengersViewController = storyboard?.instantiateViewController(withIdentifier: "PassengersViewController") as? PassengersViewController
passengersViewController?.delegate = self
floatingPanelController.delegate = self
floatingPanelController.set(contentViewController: passengersViewController)
floatingPanelController.track(scrollView: passengersViewController?.tableView)
floatingPanelController.surfaceView.backgroundColor = .clear
floatingPanelController.addPanel(toParent: self)

Environment

Library version
1.5.1

Installation method

  • CocoaPods
  • Carthage
  • Git submodules

iOS version(s)
12.2

Xcode version
10.2.1

@scenee
Copy link
Owner

scenee commented May 17, 2019

FloatingPanelController doesn't use _setContentSizeNotificationToken which looks UIView private API. I don't know why the method sent to the instance. Could you let me know a stack trace on the crash?

@Isuru-Nanayakkara
Copy link
Author

Isuru-Nanayakkara commented May 23, 2019

It's so weird. I redid the whole thing. No changes to the FloatingPanel related code. Just added a new tableview controller and it worked fine in v1.4.0. Updated it to v1.5.1 and this crash happens.

  • thread Unable to scroll to last item on TableView #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
    frame #0: 0x000000010b53fa95 libobjc.A.dylibobjc_exception_throw frame #1: 0x000000010bfb1ab4 CoreFoundation-[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    frame Enhance scroll view handling #2: 0x0000000113638c3d UIKitCore-[UIResponder doesNotRecognizeSelector:] + 287 frame #3: 0x000000010bf98443 CoreFoundationforwarding + 1443
    frame Updated view width of floating panel in landscape #4: 0x000000010bf9a238 CoreFoundation__forwarding_prep_0___ + 120 frame #5: 0x0000000113aab579 UIKitCore-[UIView dealloc] + 114
    frame How to open panel with tip position #6: 0x000000010997bd91 FloatingPanel`FloatingPanel.FloatingPanelSurfaceContentView.__deallocating_deinit + 65
    • frame How to open Panel custom height #7: 0x000000010677c03c MyVan ParentTrackViewController.viewDidLoad(self=0x00007ff9be848800) at TrackViewController.swift:36:33 frame #8: 0x000000010677c2b4 MyVan Parent@objc TrackViewController.viewDidLoad() at :0
      frame Fix surface view height #9: 0x000000011300a43b UIKitCore-[UIViewController loadViewIfRequired] + 1183 frame #10: 0x0000000112f6e004 UIKitCore-[UINavigationController _updateScrollViewFromViewController:toViewController:] + 68
      frame Fixed some typos and language in comments #11: 0x0000000112f6e2f7 UIKitCore-[UINavigationController _startTransition:fromViewController:toViewController:] + 146 frame #12: 0x0000000112f6f3b5 UIKitCore-[UINavigationController _startDeferredTransitionIfNeeded:] + 896
      frame Fix untracked scroll view's freezing in a floating panel #13: 0x0000000112f706a7 UIKitCore-[UINavigationController __viewWillLayoutSubviews] + 150 frame #14: 0x0000000112f5138d UIKitCore-[UILayoutContainerView layoutSubviews] + 217
      frame Correctly updated constraint of panel #15: 0x0000000113ada9c1 UIKitCore-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1417 frame #16: 0x000000010ab17eae QuartzCore-[CALayer layoutSublayers] + 173
      frame Release v1.1.0 #17: 0x000000010ab1cb88 QuartzCoreCA::Layer::layout_if_needed(CA::Transaction*) + 396 frame #18: 0x000000010ab28ee4 QuartzCoreCA::Layer::layout_and_display_if_needed(CA::Transaction*) + 72
      frame No support for UITableViewController? #19: 0x000000010aa983aa QuartzCoreCA::Context::commit_transaction(CA::Transaction*) + 328 frame #20: 0x000000010aacf584 QuartzCoreCA::Transaction::commit() + 608
      frame Fix show segue problem #21: 0x000000010aacfede QuartzCoreCA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76 frame #22: 0x000000010befa0f7 CoreFoundationCFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
      frame Adds an extra view controller when FloatingPanel is added to a UITabbarViewController #23: 0x000000010bef45be CoreFoundation__CFRunLoopDoObservers + 430 frame #24: 0x000000010bef4c31 CoreFoundation__CFRunLoopRun + 1505
      frame Add a removable interaction #25: 0x000000010bef4302 CoreFoundationCFRunLoopRunSpecific + 626 frame #26: 0x0000000110bf72fe GraphicsServicesGSEventRunModal + 65
      frame Fix backdrop bugs #27: 0x000000011360cba2 UIKitCoreUIApplicationMain + 140 frame #28: 0x0000000106788b9b AppNamemain at AppDelegate.swift:21:7
      frame Fix navigation bar problem #29: 0x000000010d0e9541 libdyld.dylib`start + 1

@mergesort
Copy link

I just upgraded and am encountering the same issue in the same way that @Isuru-Nanayakkara described. Definitely wasn't happening on version 1.4.1 of the FloatingPanel, but now is. I don't have much evidence for this but maybe it's based on a naming change that occurred when moving to Swift 5?

@scenee
Copy link
Owner

scenee commented May 27, 2019

Thanks, all. I would like to fix this issue ASAP.
But I'm confused now because the stack trace commented by @Isuru-Nanayakkara includes FloatingPanelSurfaceContentView instance which hasn't been used since v1.2.0.

@mergesort
Which error occurs in your case?

  1. -[FloatingPanel.FloatingPanelController _setContentSizeNotificationToken:]: unrecognized selector sent to instance: This is first case mentioned in this description.
  2. FloatingPanel.FloatingPanelSurfaceContentView.__deallocating_deinit -> -[NSObject(NSObject) doesNotRecognizeSelector:] This is second case in the above comment.

@mergesort
Copy link

Hey @scenee, thanks a lot!

  1. -[FloatingPanel.FloatingPanelController _setContentSizeNotificationToken:]: unrecognized selector sent to instance: This is first case mentioned in this description.

This is the error I see after doing nothing besides upgrading my library from 1.4.1 to 1.5.0 or 1.5.1.

@scenee
Copy link
Owner

scenee commented May 27, 2019

Thanks for your quick response! Which Swift version do you use in v1.5.x?
If you use Swift 5, could you try to build it on Swift 4.0? or could you try to delete DerivedData folder and rebuild your app?

The diff between 1.4.1 and 1.5.0 is here, but it doesn't seem there is something bad which causes this problem..

@Isuru-Nanayakkara
Copy link
Author

@scenee Weird thing happened. This issue was occurring in my work computer. Yesterday I cloned the same source and updated the pod from my home computer and ran the app and the crash didn't happen! I'm using the same Xcode version in both computers.

I pulled the changes from my work computer today and tried running the app, and the crash is occurring again 😐

@scenee
Copy link
Owner

scenee commented May 28, 2019

Thanks for your report more detail! This might be related to the Podspec update on v1.5.1. v1.4.1...v1.5.1@FloatingPanel.podspec

But SWIFT_WHOLE_MODULE_OPTIMIZATION was not recommended now.
https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes/swift_4_2_release_notes_for_xcode_10

@mergesort
Copy link

I'm experiencing similar behaviors as @Isuru-Nanayakkara. I just reinstalled FloatingPanelController to try what you suggested with Swift 5, and cannot get it to crash with either Swift 4 or Swift 5 anymore.

@scenee
Copy link
Owner

scenee commented Jun 1, 2019

Thanks, @mergesort! I glad to hear that.

Hi, all
It seems to be related to Xcode and Swift compiler behavior.
I updated the build settings on FloatingPanel in #211 to prevent the weird crash and will release it on v1.6.0. I hope the treat couldn't reproduce the weird crash.
And then I close this issue, but if you encounter the same one after v1.6.0 feel free to reopen this 👍

@scenee scenee closed this as completed Jun 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants