iOS 9 app crash on keyboard dismiss

On devices with low member (between 2-11% free), on one of our more detailed screens within a container view, when the first clicks in a textView, and after the keyboard appears, then dimisses the keyboard, the app crashs with the following back trace. We are using a custom keyboard input accessory, and the textView in question is within a collectionView cell. This crash is not reproducible on devices that have plenty of free memory. While running the app on a device that has only 2-11% free memory within Xcode, I can reporoduce the crash every time. However, I have no idea how to fix this issue since it's happing within code outside of my app's code.


Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x1833e80b0 objc_retain + 16
1  UIKit                          0x188e04314 -[UIResponder _preserveResponderOverridesWhilePerforming:] + 156
2  UIKit                          0x189333b40 -[UIInputWindowController invalidateInputAccessoryView] + 104
3  UIKit                          0x189334458 -[UIInputWindowController changeToInputViewSet:] + 992
4  UIKit                          0x18932f5d8 __77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke887 + 424
5  UIKit                          0x188a8f394 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 628
6  UIKit                          0x188a8ee90 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312
7  UIKit                          0x188a8ed18 -[UIViewAnimationState animationDidStop:finished:] + 108
8  QuartzCore                     0x186465c00 CA::Layer::run_animation_callbacks(void*) + 284
9  libdispatch.dylib              0x1837b55f0 _dispatch_client_callout + 16
10 libdispatch.dylib              0x1837bacf8 _dispatch_main_queue_callback_4CF + 1844
11 CoreFoundation                 0x183d18bb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
12 CoreFoundation                 0x183d16a18 __CFRunLoopRun + 1628
13 CoreFoundation                 0x183c45680 CFRunLoopRunSpecific + 384
14 GraphicsServices               0x185154088 GSEventRunModal + 180
15 UIKit                          0x188abcd90 UIApplicationMain + 204
16 fieldlens                      0x1000c4b5c main (main.m:17)
17 libdispatch.dylib              0x1837e68b8 (Missing)

Replies

My best guess is that one of your input accessory views is being prematurely deallocated, perhaps in response to a memory warning. To reproduce it locally, I would try profiling the application with the Zombies Instrument while simulating memory warnings at periodic intervals.

My app has this issue too. The crash back trace is the same, but I did not see any memorry warnning in my case. Do you have solved it? @stulevine

Same here. Same trace. No memory leaks at all

Have you had any lucky tracking down the cause of this crash? Some users of my app have reported a crash with the same stack trace. However, we have not been able to reproduce the crash in the debugger, and cannot figure out the type of the zombie object.


(We've reviewed the inputAccessoryViews, and the app holds strong references to them. I also tried profiling the application with the Zombies Instrument while simulating memory warnings, with no luck.)

Yes. I have this issue, too.

I am expiriencing this issue too on iPad and suppose it iOS 9 bug. Hower i found a hacky fix for my application:


[textView.inputAccessoryView removeFromSupperView];
textView.inputAccessoryView = nil;


I added this code before textView gets release

Just dimiss the keyboard before view controller disappear.


[self.view endEditing:YES];


That's sloves my crash for good.

Hope this helps.