UIKeyboardWillShowNotification triggered two times on iOS 8 and only one time on iOS 7 when rotating

Hi all,


From the very simple piece of code below, I have a strange behaviour difference between iOS 7 and 8 when rotating :

- On iOS 7 the keyboardWillShow and keyboardWillHide are called only one time each.

- On iOS 8 the keyboardWillShow and keyboardWillHide are called two times each.


I have created a very simple project to ensure that it was not a side effect of my main project, but it is not.


Is it a documented behaviour difference ?


Regards.

Sébastien.


@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

/

}

- (void)viewWillAppear:(BOOL)animated

{

[super viewWillAppear:animated];

[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(keyboardWillShow:)

name:UIKeyboardWillShowNotification

object:nil];



[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(keyboardWillHide:)

name:UIKeyboardWillHideNotification

object:nil];

}

-(void)keyboardWillShow:(NSNotification*)notification

{

NSLog(@"Keyboard will show");

}

-(void)keyboardWillHide:(NSNotification*)notification

{

NSLog(@"Keyboard will hide");

}

@end

Put a break point in your viewWillAppear and make sure that you are not subscribing to the same notification multiple times. I am not sure what the flow of your viewController is but I do not see where you remove the viewController as an observer from notification center.

If you set a breakpoint in -keyboardWillShow, what do the backtraces look like for each of the two invocations?

Hi,


I put a breakpoint in viewWillAppear and there is only one subscription for each notification.

I remove the notification in viewWillDisappear, I just drop it from the code pasted here.


Regards.

Sébastien.

Hi Dex,


What should I look for in the backtrace ?


Regards.

Sébastien.

Post them.

Hi Dex,


Here are the backtraces for iOS 8 and iOS 7. The both are taken with the same project running in the iOS simulator (the behaviour is the same in iPad devices).

First the iOS 8.3 backtraces, two times call willHide/WillShow. Then the same on iOS 7.1, one time call willHide/WillShow


Reagards.

Sebastien.


iOS 8.3 :

---------


2015-06-19 11:49:36.674 TestKWS[12305:761940] Keyboard will hide

(lldb) bt

* thread #1: tid = 0xba054, 0x000000010fe489d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48ec6, notification=0x00007fa843869890) + 64 at ViewController.m:57, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1

* frame #0: 0x000000010fe489d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48ec6, notification=0x00007fa843869890) + 64 at ViewController.m:57

frame #1: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #3: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #4: 0x00000001111a0f73 UIKit`-[UIInputWindowController postStartNotifications:withInfo:] + 340

frame #5: 0x00000001111a2832 UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke576 + 375

frame #6: 0x0000000110f8ab2b UIKit`-[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:] + 190

frame #7: 0x00000001111a253d UIKit`-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 972

frame #8: 0x0000000110b5168e UIKit`+[UIView(Animation) performWithoutAnimation:] + 65

frame #9: 0x00000001111a3e09 UIKit`__69-[UIInputWindowController willRotateToInterfaceOrientation:duration:]_block_invoke + 90

frame #10: 0x000000011119f782 UIKit`-[UIInputWindowController performWithoutAppearanceCallbacks:] + 28

frame #11: 0x00000001111a3b64 UIKit`-[UIInputWindowController willRotateToInterfaceOrientation:duration:] + 1257

frame #12: 0x0000000110c1caf1 UIKit`-[UIViewController viewWillTransitionToSize:withTransitionCoordinator:] + 317

frame #13: 0x0000000110c151c8 UIKit`+[UIViewController _performWithoutDeferringTransitions:] + 101

frame #14: 0x0000000110c24ee8 UIKit`-[UIViewController(AdaptiveSizing) _window:viewWillTransitionToSize:withTransitionCoordinator:] + 886

frame #15: 0x0000000110b2a91b UIKit`-[UIWindow _rotateToBounds:withAnimator:transitionContext:] + 459

frame #16: 0x0000000110b2ccb7 UIKit`-[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:] + 1741

frame #17: 0x0000000110b2d5fa UIKit`-[UIWindow _setRotatableClient:toOrientation:applyTransformToWindow:updateStatusBar:duration:force:isRotating:] + 559

frame #18: 0x0000000110b2c56e UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 116

frame #19: 0x0000000110df5fef UIKit`-[UITextEffectsWindow applicationWindowRotated:] + 291

frame #20: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #21: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #22: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #23: 0x0000000110b2c472 UIKit`-[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 331

frame #24: 0x0000000110b2b43e UIKit`__57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 98

frame #25: 0x0000000110b2b38e UIKit`-[UIWindow _updateToInterfaceOrientation:duration:force:] + 391

frame #26: 0x0000000110b2b7d0 UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 316

frame #27: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #28: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #29: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #30: 0x0000000110d52e59 UIKit`-[UIDevice setOrientation:animated:] + 282

frame #31: 0x0000000110aee047 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1507

frame #32: 0x0000000110aee4da UIKit`-[UIApplication sendEvent:] + 79

frame #33: 0x0000000110ad9b8f UIKit`_UIApplicationHandleEvent + 593

frame #34: 0x0000000113c1b38c GraphicsServices`_PurpleEventCallback + 756

frame #35: 0x0000000113c1ae74 GraphicsServices`PurpleEventCallback + 35

frame #36: 0x00000001106146a9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41

frame #37: 0x000000011061461b CoreFoundation`__CFRunLoopDoSource1 + 475

frame #38: 0x0000000110609e68 CoreFoundation`__CFRunLoopRun + 2200

frame #39: 0x0000000110609366 CoreFoundation`CFRunLoopRunSpecific + 470

frame #40: 0x0000000113c19a3e GraphicsServices`GSEventRunModal + 161

frame #41: 0x0000000110ad9900 UIKit`UIApplicationMain + 1282

frame #42: 0x000000010fe48d6f TestKWS`main(argc=1, argv=0x00007fff4fdb7548) + 111 at main.m:14

2015-06-19 11:50:10.643 TestKWS[12305:761940] Keyboard will show

(lldb) bt

* thread #1: tid = 0xba054, 0x000000010fe48980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48e92, notification=0x00007fa84166aaf0) + 64 at ViewController.m:51, queue = 'com.apple.main-thread', stop reason = step over

* frame #0: 0x000000010fe48980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48e92, notification=0x00007fa84166aaf0) + 64 at ViewController.m:51

frame #1: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #3: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #4: 0x00000001111a0f73 UIKit`-[UIInputWindowController postStartNotifications:withInfo:] + 340

frame #5: 0x00000001111a2832 UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke576 + 375

frame #6: 0x0000000110f8ab2b UIKit`-[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:] + 190

frame #7: 0x00000001111a253d UIKit`-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 972

frame #8: 0x0000000110b5168e UIKit`+[UIView(Animation) performWithoutAnimation:] + 65

frame #9: 0x00000001111a4432 UIKit`__78-[UIInputWindowController willAnimateRotationToInterfaceOrientation:duration:]_block_invoke + 90

frame #10: 0x000000011119f782 UIKit`-[UIInputWindowController performWithoutAppearanceCallbacks:] + 28

frame #11: 0x000000011119f7af UIKit`-[UIInputWindowController performWithoutCallbacksOrNotifications:] + 35

frame #12: 0x00000001111a405c UIKit`-[UIInputWindowController willAnimateRotationToInterfaceOrientation:duration:] + 409

frame #13: 0x000000011122970e UIKit`-[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 217

frame #14: 0x0000000111226c2e UIKit`-[_UIViewControllerTransitionContext __runAlongsideAnimations] + 139

frame #15: 0x0000000110f5226e UIKit`__58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke + 58

frame #16: 0x0000000110b52422 UIKit`+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 473

frame #17: 0x0000000110b52677 UIKit`+[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 57

frame #18: 0x0000000110f521f0 UIKit`-[_UIWindowRotationAnimationController animateTransition:] + 408

frame #19: 0x0000000110b2aa49 UIKit`-[UIWindow _rotateToBounds:withAnimator:transitionContext:] + 761

frame #20: 0x0000000110b2ccb7 UIKit`-[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:] + 1741

frame #21: 0x0000000110b2d5fa UIKit`-[UIWindow _setRotatableClient:toOrientation:applyTransformToWindow:updateStatusBar:duration:force:isRotating:] + 559

frame #22: 0x0000000110b2c56e UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 116

frame #23: 0x0000000110df5fef UIKit`-[UITextEffectsWindow applicationWindowRotated:] + 291

frame #24: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #25: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #26: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #27: 0x0000000110b2c472 UIKit`-[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 331

frame #28: 0x0000000110b2b43e UIKit`__57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 98

frame #29: 0x0000000110b2b38e UIKit`-[UIWindow _updateToInterfaceOrientation:duration:force:] + 391

frame #30: 0x0000000110b2b7d0 UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 316

frame #31: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #32: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #33: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #34: 0x0000000110d52e59 UIKit`-[UIDevice setOrientation:animated:] + 282

frame #35: 0x0000000110aee047 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1507

frame #36: 0x0000000110aee4da UIKit`-[UIApplication sendEvent:] + 79

frame #37: 0x0000000110ad9b8f UIKit`_UIApplicationHandleEvent + 593

frame #38: 0x0000000113c1b38c GraphicsServices`_PurpleEventCallback + 756

frame #39: 0x0000000113c1ae74 GraphicsServices`PurpleEventCallback + 35

frame #40: 0x00000001106146a9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41

frame #41: 0x000000011061461b CoreFoundation`__CFRunLoopDoSource1 + 475

frame #42: 0x0000000110609e68 CoreFoundation`__CFRunLoopRun + 2200

frame #43: 0x0000000110609366 CoreFoundation`CFRunLoopRunSpecific + 470

frame #44: 0x0000000113c19a3e GraphicsServices`GSEventRunModal + 161

frame #45: 0x0000000110ad9900 UIKit`UIApplicationMain + 1282

frame #46: 0x000000010fe48d6f TestKWS`main(argc=1, argv=0x00007fff4fdb7548) + 111 at main.m:14

frame #47: 0x0000000112c98145 libdyld.dylib`start + 1

frame #48: 0x0000000112c98145 libdyld.dylib`start + 1

(lldb)

2015-06-19 11:50:46.925 TestKWS[12305:761940] Keyboard will hide

(lldb) bt

* thread #1: tid = 0xba054, 0x000000010fe489d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48ec6, notification=0x00007fa843b19890) + 64 at ViewController.m:57, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1

* frame #0: 0x000000010fe489d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48ec6, notification=0x00007fa843b19890) + 64 at ViewController.m:57

frame #1: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #3: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #4: 0x00000001111a0f73 UIKit`-[UIInputWindowController postStartNotifications:withInfo:] + 340

frame #5: 0x00000001111a2832 UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke576 + 375

frame #6: 0x0000000110f8ab2b UIKit`-[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:] + 190

frame #7: 0x00000001111a253d UIKit`-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 972

frame #8: 0x0000000110b5168e UIKit`+[UIView(Animation) performWithoutAnimation:] + 65

frame #9: 0x00000001111a4d55 UIKit`__61-[UIInputWindowController didRotateFromInterfaceOrientation:]_block_invoke + 90

frame #10: 0x000000011119f782 UIKit`-[UIInputWindowController performWithoutAppearanceCallbacks:] + 28

frame #11: 0x000000011119f7af UIKit`-[UIInputWindowController performWithoutCallbacksOrNotifications:] + 35

frame #12: 0x00000001111a4c18 UIKit`-[UIInputWindowController didRotateFromInterfaceOrientation:] + 527

frame #13: 0x000000011122970e UIKit`-[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 217

frame #14: 0x0000000111226a45 UIKit`-[_UIViewControllerTransitionContext _runAlongsideCompletions] + 123

frame #15: 0x00000001112267d0 UIKit`-[_UIViewControllerTransitionContext completeTransition:] + 126

frame #16: 0x0000000110f5242b UIKit`__58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke198 + 52

frame #17: 0x0000000110b521d3 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 326

frame #18: 0x0000000110b39136 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209

frame #19: 0x0000000110b3946c UIKit`-[UIViewAnimationState animationDidStop:finished:] + 76

frame #20: 0x000000011432e882 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 308

frame #21: 0x0000000112c64614 libdispatch.dylib`_dispatch_client_callout + 8

frame #22: 0x0000000112c4ca1c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1664

frame #23: 0x00000001106481f9 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

frame #24: 0x0000000110609dcb CoreFoundation`__CFRunLoopRun + 2043

frame #25: 0x0000000110609366 CoreFoundation`CFRunLoopRunSpecific + 470

frame #26: 0x0000000113c19a3e GraphicsServices`GSEventRunModal + 161

frame #27: 0x0000000110ad9900 UIKit`UIApplicationMain + 1282

frame #28: 0x000000010fe48d6f TestKWS`main(argc=1, argv=0x00007fff4fdb7548) + 111 at main.m:14

frame #29: 0x0000000112c98145 libdyld.dylib`start + 1

frame #30: 0x0000000112c98145 libdyld.dylib`start + 1

(lldb)

2015-06-19 11:51:10.404 TestKWS[12305:761940] Keyboard will show

(lldb) bt

* thread #1: tid = 0xba054, 0x000000010fe48980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48e92, notification=0x00007fa841707930) + 64 at ViewController.m:51, queue = 'com.apple.main-thread', stop reason = step over

* frame #0: 0x000000010fe48980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007fa84381e1d0, _cmd=0x000000010fe48e92, notification=0x00007fa841707930) + 64 at ViewController.m:51

frame #1: 0x00000001106b054c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001105aea04 CoreFoundation`_CFXNotificationPost + 2484

frame #3: 0x000000010fed0968 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66

frame #4: 0x00000001111a0f73 UIKit`-[UIInputWindowController postStartNotifications:withInfo:] + 340

frame #5: 0x00000001111a2832 UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke576 + 375

frame #6: 0x0000000110f8ab2b UIKit`-[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:] + 190

frame #7: 0x00000001111a253d UIKit`-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 972

frame #8: 0x0000000110b5168e UIKit`+[UIView(Animation) performWithoutAnimation:] + 65

frame #9: 0x00000001111a4e6d UIKit`__61-[UIInputWindowController didRotateFromInterfaceOrientation:]_block_invoke725 + 90

frame #10: 0x000000011119f782 UIKit`-[UIInputWindowController performWithoutAppearanceCallbacks:] + 28

frame #11: 0x00000001111a4c6a UIKit`-[UIInputWindowController didRotateFromInterfaceOrientation:] + 609

frame #12: 0x000000011122970e UIKit`-[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 217

frame #13: 0x0000000111226a45 UIKit`-[_UIViewControllerTransitionContext _runAlongsideCompletions] + 123

frame #14: 0x00000001112267d0 UIKit`-[_UIViewControllerTransitionContext completeTransition:] + 126

frame #15: 0x0000000110f5242b UIKit`__58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke198 + 52

frame #16: 0x0000000110b521d3 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 326

frame #17: 0x0000000110b39136 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209

frame #18: 0x0000000110b3946c UIKit`-[UIViewAnimationState animationDidStop:finished:] + 76

frame #19: 0x000000011432e882 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 308

frame #20: 0x0000000112c64614 libdispatch.dylib`_dispatch_client_callout + 8

frame #21: 0x0000000112c4ca1c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1664

frame #22: 0x00000001106481f9 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

frame #23: 0x0000000110609dcb CoreFoundation`__CFRunLoopRun + 2043

frame #24: 0x0000000110609366 CoreFoundation`CFRunLoopRunSpecific + 470

frame #25: 0x0000000113c19a3e GraphicsServices`GSEventRunModal + 161

frame #26: 0x0000000110ad9900 UIKit`UIApplicationMain + 1282

frame #27: 0x000000010fe48d6f TestKWS`main(argc=1, argv=0x00007fff4fdb7548) + 111 at main.m:14

frame #28: 0x0000000112c98145 libdyld.dylib`start + 1

frame #29: 0x0000000112c98145 libdyld.dylib`start + 1

(lldb)

frame #43: 0x0000000112c98145 libdyld.dylib`start + 1

frame #44: 0x0000000112c98145 libdyld.dylib`start + 1

ios 7.1 backtraces :

--------------------



2015-06-19 11:53:24.263 TestKWS[12346:607] Keyboard will hide

(lldb) bt

* thread #1: tid = 0xbacac, 0x0000000106b719d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007f8780820d40, _cmd=0x0000000106b71ec6, notification=0x00007f87808438d0) + 64 at ViewController.m:57, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1

* frame #0: 0x0000000106b719d0 TestKWS`-[ViewController keyboardWillHide:](self=0x00007f8780820d40, _cmd=0x0000000106b71ec6, notification=0x00007f87808438d0) + 64 at ViewController.m:57

frame #1: 0x0000000107343d9c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001072a651d CoreFoundation`_CFXNotificationPost + 2381

frame #3: 0x0000000106c117fa Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 68

frame #4: 0x000000010797f3e6 UIKit`-[UIPeripheralHost prepareForRotationOfKeyboard:toOrientation:] + 587

frame #5: 0x00000001075ac452 UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 2221

frame #6: 0x00000001075abb9f UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 36

frame #7: 0x00000001075abaef UIKit`-[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 101

frame #8: 0x00000001075aadfe UIKit`-[UIWindow _updateToInterfaceOrientation:duration:force:] + 377

frame #9: 0x00000001075ab0b9 UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 309

frame #10: 0x0000000107343d9c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #11: 0x00000001072a651d CoreFoundation`_CFXNotificationPost + 2381

frame #12: 0x0000000106c117fa Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 68

frame #13: 0x0000000107777838 UIKit`-[UIDevice setOrientation:animated:] + 271

frame #14: 0x000000010757fa1a UIKit`-[UIApplication handleEvent:withNewEvent:] + 2371

frame #15: 0x0000000107580216 UIKit`-[UIApplication sendEvent:] + 79

frame #16: 0x0000000107570086 UIKit`_UIApplicationHandleEvent + 578

frame #17: 0x00000001097c071a GraphicsServices`_PurpleEventCallback + 762

frame #18: 0x00000001097c01e1 GraphicsServices`PurpleEventCallback + 35

frame #19: 0x0000000107270679 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41

frame #20: 0x000000010727044e CoreFoundation`__CFRunLoopDoSource1 + 478

frame #21: 0x0000000107299903 CoreFoundation`__CFRunLoopRun + 1939

frame #22: 0x0000000107298d83 CoreFoundation`CFRunLoopRunSpecific + 467

frame #23: 0x00000001097bef04 GraphicsServices`GSEventRunModal + 161

frame #24: 0x000000010756fe33 UIKit`UIApplicationMain + 1010

frame #25: 0x0000000106b71d6f TestKWS`main(argc=1, argv=0x00007fff5908e4f8) + 111 at main.m:14

frame #26: 0x00000001093ae5c9 libdyld.dylib`start + 1

frame #27: 0x00000001093ae5c9 libdyld.dylib`start + 1

2015-06-19 11:53:33.611 TestKWS[12346:607] Keyboard will show

(lldb) bt

* thread #1: tid = 0xbacac, 0x0000000106b71980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007f8780820d40, _cmd=0x0000000106b71e92, notification=0x00007f87809a1a60) + 64 at ViewController.m:51, queue = 'com.apple.main-thread', stop reason = step over

* frame #0: 0x0000000106b71980 TestKWS`-[ViewController keyboardWillShow:](self=0x00007f8780820d40, _cmd=0x0000000106b71e92, notification=0x00007f87809a1a60) + 64 at ViewController.m:51

frame #1: 0x0000000107343d9c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #2: 0x00000001072a651d CoreFoundation`_CFXNotificationPost + 2381

frame #3: 0x0000000106c117fa Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 68

frame #4: 0x0000000107980e22 UIKit`-[UIPeripheralHost rotateKeyboard:toOrientation:] + 5115

frame #5: 0x00000001075acf34 UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5007

frame #6: 0x00000001075abb9f UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 36

frame #7: 0x00000001075abaef UIKit`-[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 101

frame #8: 0x00000001075aadfe UIKit`-[UIWindow _updateToInterfaceOrientation:duration:force:] + 377

frame #9: 0x00000001075ab0b9 UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 309

frame #10: 0x0000000107343d9c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12

frame #11: 0x00000001072a651d CoreFoundation`_CFXNotificationPost + 2381

frame #12: 0x0000000106c117fa Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 68

frame #13: 0x0000000107777838 UIKit`-[UIDevice setOrientation:animated:] + 271

frame #14: 0x000000010757fa1a UIKit`-[UIApplication handleEvent:withNewEvent:] + 2371

frame #15: 0x0000000107580216 UIKit`-[UIApplication sendEvent:] + 79

frame #16: 0x0000000107570086 UIKit`_UIApplicationHandleEvent + 578

frame #17: 0x00000001097c071a GraphicsServices`_PurpleEventCallback + 762

frame #18: 0x00000001097c01e1 GraphicsServices`PurpleEventCallback + 35

frame #19: 0x0000000107270679 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41

frame #20: 0x000000010727044e CoreFoundation`__CFRunLoopDoSource1 + 478

frame #21: 0x0000000107299903 CoreFoundation`__CFRunLoopRun + 1939

frame #22: 0x0000000107298d83 CoreFoundation`CFRunLoopRunSpecific + 467

frame #23: 0x00000001097bef04 GraphicsServices`GSEventRunModal + 161

frame #24: 0x000000010756fe33 UIKit`UIApplicationMain + 1010

frame #25: 0x0000000106b71d6f TestKWS`main(argc=1, argv=0x00007fff5908e4f8) + 111 at main.m:14

frame #26: 0x00000001093ae5c9 libdyld.dylib`start + 1

frame #27: 0x00000001093ae5c9 libdyld.dylib`start + 1

UIKeyboardWillShowNotification triggered two times on iOS 8 and only one time on iOS 7 when rotating
 
 
Q