[Bug] Crashes every time TextView grows if you don't declare textViewDidChangeHeight from the Delegate
nuno-vieira opened this issue · 3 comments
If you don't define the textViewDidChangeHeight "optional" method from the delegate, it crashes. So i don't actually need that method from the delegate. So for now, i'm calling the method, but leave it empty.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Vilger.MessageViewController textViewDidChangeHeight:height:]: unrecognized selector sent to instance 0x7fc978d23720'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109357d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000108db921e objc_exception_throw + 48
2 CoreFoundation 0x00000001093c7f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001092dce1e forwarding + 526
4 CoreFoundation 0x00000001092dcb88 _CF_forwarding_prep_0 + 120
5 GrowingTextView 0x000000010574bcf6 TFC15GrowingTextView15GrowingTextView14layoutSubviewsfT_T + 1958
6 GrowingTextView 0x000000010574bf62 TToFC15GrowingTextView15GrowingTextView14layoutSubviewsfT_T + 34
7 UIKit 0x0000000106ca0ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
8 QuartzCore 0x0000000105d5dbf8 -[CALayer layoutSublayers] + 146
9 QuartzCore 0x0000000105d51440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
10 QuartzCore 0x0000000105d512be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
11 QuartzCore 0x0000000105cdf318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
12 QuartzCore 0x0000000105d0c3ff _ZN2CA11Transaction6commitEv + 475
13 QuartzCore 0x0000000105c677f7 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611
14 CoreFoundation 0x00000001092e9db4 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
15 CoreFoundation 0x00000001092e9a43 __CFRunLoopDoTimer + 1075
16 CoreFoundation 0x00000001092e95ca __CFRunLoopDoTimers + 250
17 CoreFoundation 0x00000001092e12f1 __CFRunLoopRun + 2065
18 CoreFoundation 0x00000001092e0884 CFRunLoopRunSpecific + 420
19 GraphicsServices 0x000000010c4fea6f GSEventRunModal + 161
20 UIKit 0x0000000106bdbc68 UIApplicationMain + 159
21 Vilger 0x000000010363e58f main + 111
22 libdyld.dylib 0x000000010aee568d start + 1
)
Update: I thought that is was happing only in version 0.2.2, but on version 0.2.1, it does the same
I was wrongly unwrapping the optional delegate when calling it. It has been fixed. Thanks!
By the way, the delegate method has changed since 0.2.2:
textViewDidChangeHeight(_ textView: GrowingTextView, height: CGFloat)
No problem! Nice library, congratulations! I'll help whenever i can, and i'll be using it for sure, it is really handy ;)