bluetooth keyboard override - ios

Is there a way to force up a software keyboard when the user has a iOS bluetooth keyboard device installed?
Or, to that end, is it possible in code to disable a specific bluetooth device?
Thanks!

In most (maybe all?) iOS apps with which I have used Apple's bluetooth keyboard, pressing the eject key (located in the top right corner) will bring up the soft keyboard on the screen. Maybe that little factoid could help you in some way.

Not from within the application's code, if you're planning on getting into the app store. Apple expressly does not provide methods to show or hide keyboard, instead pushing you to use becomeFirstResponder and resignFirstResponder.
You may be able to do this through some non-AppStore-friendly methods, but somehow I don't think that's the answer you're looking for.
(Note - you could make a fake, Apple-looking keyboard when the real one is hidden, and check if the real one is hidden based on whether a view is visible, but if Apple notices you doing this, you'll get denied.)

Related

How to detect the Smart/external Keyboard on iPad?

How can one get a notification when a (Smart) keyboard is connected?
Some context:
I am working on a feature that automatically shows and hides my software keyboard based on whether the iPad Pro Smart Keyboard, or another external keyboard is connected or not (like Pages). I have seen this answer but that only applies when a textfield is selected. After a lot of googling, I stumbled into the Apple's ExternalAccessory class which you can ask for connected devices, and then check what these devices are.
I have tried a basic implementation of this and I can't get it to work on my iPad Pro with connected Smart Keyboard (Yes, I am sure it's connected because I can see the letters I type appear on my screen πŸ˜…).
First of all, the docs say that you can detect devices that are through over Bluetooth and Lightning, I can only to hope this also includes the Smart Keyboard connector. I have enabled the Wireless Accessory Configuration capability of my project.
Second, one needs to add the UISupportedExternalAccessoryProtocols key to their info.plist, then needs to specify which protocols are connected. Which protocols there are doesn't seem to be documented, also not for Apple's own devices. I ran into a tutorial that mentioned the iAP2 bluetooth protocol, so I added this and then hoped for the best.
My code
As I haven't set up my project configuration right yet, I didn't add a lot of code either. I tried:
func printAllAccessories() {
for device in EAAccessoryManager.shared().connectedAccessories {
print("connected device with name: ", device.name)
}
}
But noting seems to be connected.
Bottom line
What is the process, including project configuration, to get external keyboard notifications in an iOS App?
There doesn't seem to be any comprehensive documentation of this online so it's probably nice to get that here. Any help would be highly appreciated!
First of all this doesn't work because smart connector is not using bluetooth to connect to device. You can read more about that on this page Use your Smart Keyboard Folio or Smart Keyboard with iPad Pro.
Second thing is that apple Smart Keyboard and external keyboard is totally different thing. Apple Smart Keyboard can be used as iPad case and as iPad keyboard. External keyboard is used only as keyboard and nothing else.
So from this we can conclude that when you connect you Smart Keyboard to iPad with Smart Connector iPad will treat it as iPad case, which gives you protection for your iPad and no other functionality which would impact on your software(try to type on it or use any shortcuts, nothing will work). iPad will recognise Smart Keyboard as keyboard only when it will be folded in type position. This is the main difference from external keyboard. External keyboard will be recognised as soon as you connect it via bluetooth.
Pages app will hide keyboard only if the external keyboard is connected via bluetooth or your Smart Keyboard is in type position. If Smart Keyboard is connected to Smart Connector and is not in type position there will still be software keyboard until you fold it in to type position. This means that iOS will handle hiding and showing keyboard.
For handling key presses performed on hardware keyboard you can refer to this class UIKeyCommand.

Custom keyboard: stability

I created some custom keyboard, and although I wasn't able to really test it I have an impression that my keyboard is extremely unstable on device.
In some cases it just isn't loaded in app (I have it with Telegram messenger; when my keyboard is active and I'm trying to open Telegram I don't have any keyboard at all from time to time; to fix it I have to open any other app with keyboard input and go back to Telegram).
In some cases it is unloaded without user's interaction.
In some cases it is shown in keyboards list (not in the settings, but after the long tap on the switch keyboard button) as "(null)-myKeyboard". Sometimes it happens just after install (but if I'm just wait for, like, a minute β€”Β it will work)
In some cases β€” and this one worries me the most β€” my keyboard is removed from the active keyboards list in Settings.
When it works, it works. But it is obviously not very usable.
My keyboard is written in Swift (a bunch of buttons with a lot of NSLayoutConstraints, all written in code); I'm using Realm to store some constants; I have like 3-4 small images on buttons; I need full access for my keyboard.
Could you please give me some directions? What could be the problem here, and what is the best way to find it?

Would a physical keyboard prevent a inputAccessoryView from appearing?

I've added an inputAccessoryView to the iOS keyboard for certain UITextFields in my app. This accessory view provides essential functionality to the user (some buttons that are displayed nowhere else in my app). My understanding (which could be completely wrong) is that if a physical (bluetooth) keyboard is available iOS will not clutter the screen with the software keyboard. If that's the case, users of my app with a physical keyboard will be missing some functionality and I'll need to account for that. So the first question is, is that something I have to worry about? Thanks.
The input accessory view should appear at the bottom of the screen if a physical keyboard is used, so they will still be able to access the functionality. If you want to try this in the simulator, check the Simulate Hardware Keyboard option under the Hardware menu.

Disabling Split Option in iOS5 Keyboard

I am facing problem in my app because of the new split keyboard option in iOS5.
Is there any way we can hide or disable this option in objective C?.
Thanks in advance.
Seems like the split keyboard does not use the same functions as regular keyboard. see here.
missing kb notifications
Here's the problem: You can iterate through the keyboard subviews and hide the button but you can't control the state of the keyboard when going from one app to the next. It would get really tricky and sneaky to force the private api to call when the application did enter foreground and the keyboard became active.
You could do this but apple may deny you from the store.
Fix your view to account for the keyboard movement. Your users will dock or unsplit the keyboard when there's clear disruption in the UI due to the keyboard placement.
Other solutions could be to move the entire view that requires keyboard placement to be docked or undocked using the notifications. See other posting here: StackOverflow article

iphone os custom keyboard

I've read a lot of topics about developing a custom keyboard for iOS and it's clear that it is impossible to build a system-wide alternative keyboard.
But I still try to understand how Emoji keyboard(the emoticons additional layer) could make it possible and it is an official app on AppStore (that means it passes Apple approval!).
Note that their keyboard, once installed, can be added in Keyboard section in Settings!
Thanks for help
Emoji apps enable a by-default-disabled keyboard built into iOS. If I recall correctly, it's enabled by default in certain regions (Japan) but disabled in most places. So they aren't adding a new keyboard, just revealing one that's already there.
edit: ... and here's how they do it
The Emoji Icons are a stored in the private use area of unicode. They won't look any good on a different device than an iPhone/iPad, this is Apple specific.
The app is just to enable the keyboard. You can do it yourself: Making An Emoji Enabeling App.
Have a look at The truth about iPhone Emoji, which sheds some light on the whole topic.

Resources