{"action":"created","issue":{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/763","labels_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/763/labels{/name}","comments_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/763/comments","events_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/763/events","html_url":"https://github.com/jessesquires/JSQMessagesViewController/issues/763","id":55556533,"number":763,"title":"Keyboard Notification Race","user":{"login":"walsh2000","id":4912283,"avatar_url":"https://avatars.githubusercontent.com/u/4912283?v=3","gravatar_id":"","url":"https://api.github.com/users/walsh2000","html_url":"https://github.com/walsh2000","followers_url":"https://api.github.com/users/walsh2000/followers","following_url":"https://api.github.com/users/walsh2000/following{/other_user}","gists_url":"https://api.github.com/users/walsh2000/gists{/gist_id}","starred_url":"https://api.github.com/users/walsh2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/walsh2000/subscriptions","organizations_url":"https://api.github.com/users/walsh2000/orgs","repos_url":"https://api.github.com/users/walsh2000/repos","events_url":"https://api.github.com/users/walsh2000/events{/privacy}","received_events_url":"https://api.github.com/users/walsh2000/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/labels/bug","name":"bug","color":"E64545"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/milestones/9","html_url":"https://github.com/jessesquires/JSQMessagesViewController/milestones/Release%206.1.4","labels_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/milestones/9/labels","id":969639,"number":9,"title":"Release 6.1.4","description":"","creator":{"login":"jessesquires","id":2301114,"avatar_url":"https://avatars.githubusercontent.com/u/2301114?v=3","gravatar_id":"","url":"https://api.github.com/users/jessesquires","html_url":"https://github.com/jessesquires","followers_url":"https://api.github.com/users/jessesquires/followers","following_url":"https://api.github.com/users/jessesquires/following{/other_user}","gists_url":"https://api.github.com/users/jessesquires/gists{/gist_id}","starred_url":"https://api.github.com/users/jessesquires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessesquires/subscriptions","organizations_url":"https://api.github.com/users/jessesquires/orgs","repos_url":"https://api.github.com/users/jessesquires/repos","events_url":"https://api.github.com/users/jessesquires/events{/privacy}","received_events_url":"https://api.github.com/users/jessesquires/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":9,"state":"open","created_at":"2015-02-07T04:07:41Z","updated_at":"2015-02-27T03:32:57Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2015-01-27T00:03:28Z","updated_at":"2015-02-27T03:38:32Z","closed_at":null,"body":"@jessesquires \r\n\r\nHave you seen or heard of the toolbar occasionally getting out of place relative to the keyboard?\r\n\r\nI've cornered a hard-to-reproduce situation which causes the toolbar to be behind the keyboard.\r\n\r\nWhen a keyboard dismisses then is shown quickly (as when pushing from a VC which was showing the keyboard into a JSQMessagesViewController subclass) the keyboardControllerKeyboardDidHide delegate callback arrives after the frame change notifications.\r\n\r\n1. jsq_didReceiveKeyboardDidHideNotification calls jsq_handleKeyboardNotification\r\n2. jsq_didReceiveKeyboardDidShowNotification calls jsq_handleKeyboardNotification\r\n3. the jsq_didReceiveKeyboardDidHideNotification animation completion block fires, calling the delegate's keyboardControllerKeyboardDidHide.\r\n\r\n````\r\n2015-01-26 15:53:03.856 ChatApp[6715:60b] ----- jsq_notifyKeyboardFrameNotificationForFrame\r\n2015-01-26 15:53:03.857 ChatApp[6715:60b] keyboardDidChangeFrame\r\n2015-01-26 15:53:03.870 ChatApp[6715:60b] ----- jsq_notifyKeyboardFrameNotificationForFrame\r\n2015-01-26 15:53:03.871 ChatApp[6715:60b] keyboardDidChangeFrame\r\n2015-01-26 15:53:03.873 ChatApp[6715:60b] ----- jsq_notifyKeyboardFrameNotificationForFrame\r\n2015-01-26 15:53:03.874 ChatApp[6715:60b] keyboardDidChangeFrame\r\n2015-01-26 15:53:03.887 ChatApp[6715:60b] ----- jsq_notifyKeyboardFrameNotificationForFrame\r\n2015-01-26 15:53:03.888 ChatApp[6715:60b] keyboardDidChangeFrame\r\n2015-01-26 15:53:03.889 ChatApp[6715:60b] ----- jsq_notifyKeyboardFrameNotificationForFrame\r\n2015-01-26 15:53:03.890 ChatApp[6715:60b] keyboardDidChangeFrame\r\n2015-01-26 15:53:03.928 ChatApp[6715:60b] HIDE jsq_handleKeyboardNotification animation finished: 1\r\n2015-01-26 15:53:03.929 ChatApp[6715:60b] keyboardControllerKeyboardDidHide\r\n2015-01-26 15:53:03.930 ChatApp[6715:60b] SHOW jsq_handleKeyboardNotification animation finished: 1\r\n````\r\n\r\nWhile the show animation completes after the hide animation, there is no notification to the delegate, so the delegate was last told that the keyboard did hide.\r\n\r\nThe problem is this:\r\nThe toolbar is adjusted upward when the frame changes (which is during the animation) and the toolbar is adjusted downward both when the frame changes and when keyboardControllerKeyboardDidHide is called, which is after the animation.\r\n\r\nOne solution I can see is to fire a redundant frame-change notification in the show keyboard animation completion block:\r\n\r\n````\r\n    [self jsq_handleKeyboardNotification:notification completion:^(BOOL finished) {\r\n        [self.panGestureRecognizer addTarget:self action:@selector(jsq_handlePanGestureRecognizer:)];\r\n\t\t[self jsq_handleKeyboardNotification:notification completion:nil];\r\n    }];\r\n````\r\n\r\nAnother solution would be a dedicated delegate message for keyboardControllerKeyboardDidShow.\r\nYet another solution would be to remove the keyboardControllerKeyboardDidHide message rely on the frame change messages.\r\n\r\nDo you have any thoughts on this issue?\r\nRay\r\n"},"comment":{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/comments/76325587","html_url":"https://github.com/jessesquires/JSQMessagesViewController/issues/763#issuecomment-76325587","issue_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/763","id":76325587,"user":{"login":"jessesquires","id":2301114,"avatar_url":"https://avatars.githubusercontent.com/u/2301114?v=3","gravatar_id":"","url":"https://api.github.com/users/jessesquires","html_url":"https://github.com/jessesquires","followers_url":"https://api.github.com/users/jessesquires/followers","following_url":"https://api.github.com/users/jessesquires/following{/other_user}","gists_url":"https://api.github.com/users/jessesquires/gists{/gist_id}","starred_url":"https://api.github.com/users/jessesquires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessesquires/subscriptions","organizations_url":"https://api.github.com/users/jessesquires/orgs","repos_url":"https://api.github.com/users/jessesquires/repos","events_url":"https://api.github.com/users/jessesquires/events{/privacy}","received_events_url":"https://api.github.com/users/jessesquires/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T03:38:32Z","updated_at":"2015-02-27T03:38:32Z","body":"hey @walsh2000 and others - just bashed some bugs tonight and closed a number of issues.\r\n\r\nI would love some help on this — the last major issue before the 6.1.4 release is ready for Cocoapods."}}