title: Hide inputAccessoryView if hardware keyboard is connected
body: <p>Similar to this question: <a href="https://stackoverflow.com/questions/5019471/ipad-detecting-external-keyboard">iPad: Detecting External Keyboard</a>, I am developing an iPad app that is using text fields with a custom <code>inputAccessoryView</code> to provide additional functionality for the virtual keyboard.</p>
  
  <p>However, if a <em>hardware keyboard</em> (e.g. bluetooth keyboard) is connected to the device, the software keyboard is not shown as expected, but for some reason the inputAccessoryView is <em>still visible</em> at the bottom of the screen. Additionally, this seems to cause firing the <code>UIKeyboardDidShowNotification</code>(and therefore moving my view up to avoid occlusion by the keyboard which is actually not present) even if the hardware keyboard is used for input.</p>
  
  <p>I found several solutions to detect if a hardware keyboard is connected, but all of them check the state <em>after</em> receiving a <code>UIKeyboardDidShowNotification</code>, at which point the inputAccessoryView is already visible (e.g. <a href="https://stackoverflow.com/questions/2893267/how-can-i-detect-if-an-external-keyboard-is-present-on-an-ipad">How can I detect if an external keyboard is present on an iPad?</a>). </p>
  
  <p>I am looking for a way to only show a inputAccessoryView if there is no hardware keyboard connected. Therefore I need to know if a hardware keyboard is connected <strong>before</strong> a <code>UIKeyboardDidShowNotification</code> is fired. </p>
  
  <p>The accepted solutions provided here <a href="https://stackoverflow.com/questions/2893267/how-can-i-detect-if-an-external-keyboard-is-present-on-an-ipad">How can I detect if an external keyboard is present on an iPad?</a> are no option for me as they use private APIs which may cause my app to get rejected.</p>