chronotruck / FlagPhoneNumber

A formatted phone number UITextField with country flag picker.
Apache License 2.0
437 stars 317 forks source link

App Crash on iPad Press undo button #121

Open AminFadul opened 5 years ago

AminFadul commented 5 years ago

first of all for some reason in iPad it doesn't make the textfield keyboard type numeric like in the iphone version and that numeric a problem regarding the undo button when i press it the app crash with this log

Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSBigMutableString substringWithRange:]: Range {3, 0} out of bounds; string length 2' First throw call stack: ( 0 CoreFoundation 0x00000001115be8db exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010fe58ac5 objc_exception_throw + 48 2 CoreFoundation 0x00000001115be735 +[NSException raise:format:] + 197 3 Foundation 0x000000010d6ae9fc -[NSString substringWithRange:] + 131 4 UIKitCore 0x000000011aa29f3f -[NSTextStorage(UIKitUndoExtensions) _undoRedoAttributedSubstringFromRange:] + 133 5 UIKitCore 0x000000011aa2ade9 -[_UITextUndoOperationTyping undoRedo] + 327 6 Foundation 0x000000010d71fee9 -[_NSUndoStack popAndInvoke] + 280 7 Foundation 0x000000010d71e18f -[NSUndoManager undoNestedGroup] + 433 8 UIKitCore 0x000000011a5037d8 -[UIKeyboardAssistantBar executeAction:] + 342 9 UIKitCore 0x000000011a6f8624 -[UIApplication sendAction:to:from:forEvent:] + 83 10 UIKitCore 0x0000000119e6080f __45-[_UIButtonBarTargetAction _invoke:forEvent:]_blockinvoke + 154 11 UIKitCore 0x0000000119e7313d UIGroupedBarCreateButtonBar_block_invoke + 136 12 UIKitCore 0x0000000119e60740 -[_UIButtonBarTargetAction _invoke:forEvent:] + 144 13 UIKitCore 0x000000011a6f8624 -[UIApplication sendAction:to:from:forEvent:] + 83 14 UIKitCore 0x000000011a14d8d5 -[UIControl sendAction:to:forEvent:] + 67 15 UIKitCore 0x000000011a14dbf2 -[UIControl _sendActionsForEvents:withEvent:] + 450 16 UIKitCore 0x000000011a14cba8 -[UIControl touchesEnded:withEvent:] + 583 17 UIKitCore 0x000000011a7314e6 -[UIWindow _sendTouchesForEvent:] + 2547 18 UIKitCore 0x000000011a732bca -[UIWindow sendEvent:] + 4079 19 UIKitCore 0x000000011a71130e -[UIApplication sendEvent:] + 356 20 UIKitCore 0x000000011a7e12b3 dispatchPreprocessedEventFromEventQueue + 3232 21 UIKitCore 0x000000011a7e3bd9 handleEventQueueInternal + 5911 22 CoreFoundation 0x0000000111525db1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 23 CoreFoundation 0x0000000111525633 CFRunLoopDoSources0 + 243 24 CoreFoundation 0x000000011151fcef CFRunLoopRun + 1231 25 CoreFoundation 0x000000011151f4d2 CFRunLoopRunSpecific + 626 26 GraphicsServices 0x0000000115a9a2fe GSEventRunModal + 65 27 UIKitCore 0x000000011a6f6fc2 UIApplicationMain + 140 28 SallaMerchantAppIOS 0x0000000109790a7b main + 75 29 libdyld.dylib 0x0000000112c23541 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Screenshot 2019-09-12 14 48 21

Steps to reproduce the behavior: 1- install on iPad 2- try to press the undo button

Expected behavior it should not display this kind of keyboard type and crash on tab action