How to show virtual keyboard and capture its input?

Can anyone please share how to show a virtual keyboard and capture its input under Monogame for iOS? I have managed to get it done on Android, but failed to find any samples for iOS.

I want to let my users enter their name after pressing a button (my own MG element). As the user would type on the virtual keyboard the button will change its caption accordingly. After closing the virtual keyboard the player name would be updated and saved.

Many thanks!

I noticed in the source code to MonoGame.Framework that there was a class named Guide which should handle this behaviour, but it no longer seems to be a part of the nuget package. In fact the whole Microsoft.Xna.Framework.GamerServices namespace seems to be gone. Any ideas? Does no-one else really need this? I find it hart to believe that I am the only one.

Yes you use guide.

This is from memory but I think it’s

guide.beginshowkeyboardinput

If u Google it with xna it will show u how to implement it.

Edit:

I also think that you need to add this in your inizalize part

compoants.add(new gamerservicecomponate());

Thank you for your reply. Are you sure this still works in MG 3.6? The GamerServicesComponent is not a recognized class name any more, if you look into the nuget package it lacks the whole GamerServices namespace. What is the equivalent in MG 3.6?

OK, here is my solution, even though it is an ugly one. For reasons not explained anywhere MG 3.3+ no longer includes namespaces Mariasek.Xna.Framework.Net and Mariasek.Xna.Framework.GamerServices. This means that support for the soft on screen keyboard input is not part of the nuget package. There are some old articles on the web stating that these have moved to a separate nuget package called Mariasek.Framework.Net.dll - this is not true any longer, as of end of 2017 there is no other package to my knowledge that contains this functionality available on nuget.org

Should you want these features you have to download MG from GitHub and build it yourself and then include references to MonoGame.Framework.dll and MonoGame.Framework.Net.dll in your project - the latter dll contains the .GamerServices and .Net namespaces. You cannot use the dlls from the nuget BTW as at least for iOS there are some missing references.

Once you have done that you may call Guide.BeginShowKeyboardInput(...) just note that the function does not support passing of the state object contrary to what the XNA documentation claims - so should you want to pass a state object to EndShowKeyboardInput() you have to use other means to do so (like a private field or property, be careful about thread safety).

Hope this helps!