How difficult it would be to install an application that could record users keystrokes on an Apple device, for example, an iPhone X, and send it online without the knowledge of the user.
Keyboard apps can transmit keystrokes, but the user must explicitly allow Full Access to the app.– Irfan434Aug 5, 2018 at 10:35
This answer will only explore privilege escalation to install the keystroke logger at root level or above. Other options are offered as part of parental controls or custom keyboards, but I will not explore those.
For the most part, performing clandestine keylogging I believe to be effective must be installed and operated with "higher privileges". This would for the best part involve privilege escalation which involves "exploiting a bug, design flaw or configuration oversight in an operating system or software application to gain elevated access to resources that are normally protected from an application or user".
The privilege elevation could be archived by iOS jailbreaking, a method of privilege elevation with the purpose of removing software restrictions imposed by Apple. Jailbreaking will allow root access to iOS which will allow us to install a keylogger within iOS's file system. Which will make the device seem like nothing has changed, and it's a stock version of iOS shipped by Apple. This is not the scenario, the kernel verifies the file system on startup against checksums. Hence, we must reverse engineer and rewrite the kernel with a "custom" kernel to allow for this privilege elevation and the keylogger at root level to be maintained.
If the kernel is not patched for the modified file system it will not boot. The difference can be explored further by reviewing the difference between tethered and untethered jailbreaking.
With this knowledge, software keylogging on the kernel or root level is possible. Despite the pedanticism that must be dealt with to get this level of "undetectable" access on Apple iOS, it's completely possible.
With the use of reverse proxy(s), VPN and/or a darknet service, the keylogger can "phone home" reporting the intercepted keystrokes, without risking their anonymity.