Skip to content

Instantly share code, notes, and snippets.

@inamiy
Created April 16, 2018 13:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inamiy/d61ea7d0850a9d8470b5b2d60cba9d48 to your computer and use it in GitHub Desktop.
Save inamiy/d61ea7d0850a9d8470b5b2d60cba9d48 to your computer and use it in GitHub Desktop.
RxSwift v4.0.0 KVO + methodInvoked collision
example("Crash") {
let scrollView = UIScrollView()
scrollView.rx.observe(CGSize.self, "contentSize").subscribe()
scrollView.rx.methodInvoked(#selector(UIScrollView.layoutSubviews)).subscribe()
// --- Unhandled error happened: Collision between RxCocoa interception mechanism and KVO. To resolve this conflict please use this interception mechanism first. example ---
// Unhandled error happened: Collision between RxCocoa interception mechanism and KVO. To resolve this conflict please use this interception mechanism first.
// Target: <UIScrollView: 0x7fa397810600; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60c000042820>; layer = <CALayer: 0x60c00002d660>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}>
// subscription called from:
//
}
@inamiy
Copy link
Author

inamiy commented Apr 16, 2018

Note: Call order doesn't matter.

@Sajjon
Copy link

Sajjon commented May 2, 2018

I too get this problem using Xcode 9.3, Swift 4.1 and Cocoapods 1.5 without use_frameworks!. If I include use_frameworks! in the Podfile it works. hmm.... Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment