UIViewReportBrokenSuperviewChain iOS 10 crash

#23 · closed · 9 comments

View on GitHub ↗

elprl

I'm getting the following error on iOS 10. This is a new error so not seen a lot on Stackoverflow about this: http://stackoverflow.com/questions/39565424/swift-uiviewreportbrokensuperviewchain-cause-by-layer-manipulation `Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'View has lost track of its superview, most likely through unsupported use of CALayer API on the view's layer. If this isn't a crash yet, it will be in the near future. Problem view: <UIView: 0x7e70e630; frame = (0 0; 72 205); alpha = 0; layer = <CALayer: 0x7a6521b0>> Expected parent: <ZFRippleButton.ZFRippleButton: 0x7a906fb0; baseClass = UIButton; frame = (528 12; 72 205); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7e7144e0>> Break on UIViewReportBrokenSuperviewChain to debug.'`

Comments

elprl

When I comment out `layer.addSublayer(rippleBackgroundView.layer)` I get no errors. All my buttons are added via Interface Builder, so no code. Xcode 8.1 Beta with a Swift3 project.

sravanco

@elprl But did the ripple effect exists after removing rippleBackgroundView? I see no more ripple effect after commenting out this statement. All on IB, no code. XCode 8 and Swift3.

sravanco

Instead of layer, using view.addSubView(subView) did fix the problem. ``` rippleBackgroundView.addSubview(rippleView) self.addSubview(rippleBackgroundView) ```

elprl

Yep, the ripple did stop after commenting out that line. It was just to highlight where the error was occurring. Good to know you fixed it.

kiwo12345

@elprl @sravanco What branch are you using? I could not find any swift 3 branch

sravanco

@kiwo12345 Neither I. Its just one file so I quickly adapted to Swift3. No Carthage support so I have to drop the file into my project. I didn't use but did you check this already, https://github.com/zoonooz/ZFRippleButton/pull/21/commits/84df0f39c6d7eb78fcb501b3d074a2fcac30c218

kiwo12345

@sravanco Thanks!

kiwo12345

@sravanco @elprl I dont think you have to add ``` rippleBackgroundView.addSubview(rippleView) self.addSubview(rippleBackgroundView) ``` If you build the project in Xocde 8.1. Atleast i dont see the problem if I build in 8.1 and test on a device running ios >= 10

vitobellini

I was with Xcode 8.0, those two lines of code did the trick. I'll check further with Xcode 8.1 ## Ing. Vito Bellini Mobile: (+39) 348 8908593 [email protected] http://www.vitobellini.com On Wed, Nov 2, 2016 at 3:13 PM, Kevin Thulin [email protected] wrote: > @sravanco https://github.com/sravanco @elprl https://github.com/elprl > I dont think you have to add > > rippleBackgroundView.addSubview(rippleView) > self.addSubview(rippleBackgroundView) > > If you build the project in Xocde 8.1. Atleast i dont see the problem if I > build in 8.1 and test on a device running ios >= 10 > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > https://github.com/zoonooz/ZFRippleButton/issues/23#issuecomment-257876107, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AAKHb9_gDb2eURb3uLgKa3IDCHVfaVJTks5q6JpugaJpZM4KF_Vt > .