-
Notifications
You must be signed in to change notification settings - Fork 40
Description
We've been using MaterialTextField in our app for about a year.
While testing our app for iOS 13.0 with the latest Xcode 11 beta (beta 7), we ran into an issue with MaterialTextField. The MaterialTextFields in our app have placeholderAnimatesOnFocus enabled. The issue we ran into is that when focus leaves an empty MaterialTextField with a placeholder, the app crashes with an EXC_BAD_ACCESS (code=2, address=...) error. This appears to be a stack overflow. The bottom of the stack at exception time looks like this:
#10352 0x0000000105de5bad in -[MFTextField layoutSubviews] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:325
#10353 0x000000011287366e in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#10354 0x0000000105f4d2bd in -[CALayer layoutSublayers] ()
#10355 0x0000000105f51cc3 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#10356 0x000000011285e981 in -[UIView(Hierarchy) layoutBelowIfNeeded] ()
#10357 0x0000000105de6d13 in -[MFTextField hidePlaceholderLabelAnimated:] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:467
#10358 0x0000000105de5ca3 in -[MFTextField layoutPlaceholderLabelAnimated:] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:342
#10359 0x0000000105de5bad in -[MFTextField layoutSubviews] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:325
#10360 0x000000011287366e in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#10361 0x0000000105f4d2bd in -[CALayer layoutSublayers] ()
#10362 0x0000000105f51cc3 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#10363 0x000000011285e981 in -[UIView(Hierarchy) layoutBelowIfNeeded] ()
#10364 0x0000000105de6d13 in -[MFTextField hidePlaceholderLabelAnimated:] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:467
#10365 0x0000000105de5ca3 in -[MFTextField layoutPlaceholderLabelAnimated:] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:342
#10366 0x0000000105de5bad in -[MFTextField layoutSubviews] at <snip>/Pods/MaterialTextField/MaterialTextField/MFTextField.m:325
#10367 0x000000011287366e in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#10368 0x0000000105f4d2bd in -[CALayer layoutSublayers] ()
#10369 0x0000000105f51cc3 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#10370 0x0000000105f5e3a8 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#10371 0x0000000105ea6a20 in CA::Context::commit_transaction(CA::Transaction*, double) ()
#10372 0x0000000105edc02b in CA::Transaction::commit() ()
#10373 0x00000001123c8b61 in _afterCACommitHandler ()
#10374 0x0000000107756eb7 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#10375 0x000000010775194e in __CFRunLoopDoObservers ()
#10376 0x0000000107751fca in __CFRunLoopRun ()
#10377 0x00000001077516b6 in CFRunLoopRunSpecific ()
#10378 0x000000010b3b3bb0 in GSEventRunModal ()
#10379 0x000000011239f90f in UIApplicationMain ()
The top part, with calls to [MFTextField hidePlaceholderLabelAnimated:], [MFTextField layoutPlaceholderLabelAnimated:] and [MFTextField layoutSubviews], keep repeating to the top of the stack.
The issue does not occur if we disable animation, nor when we disable placeholderAnimatesOnFocus. It also does not occur with Xcode 10/iOS 12.
I've downloaded the source to try the demo app in the repository with Xcode 11 beta to see if it has the same issue, but it doesn't crash. I've been trying to change some settings in the demo app to match our setup more closely, but I haven't been able to reproduce it yet.
Browsing the repository history, I did notice there has been a similar issue before (commit 17e4908), but the changes to fix this were (partially?) reverted later.
Hopefully, this is enough information to investigate (and possibly fix) this issue. In the mean time, I will see if I can make a reproduction using the demo app.