Currently, some users are having trouble with the charging process. A few iPhone Xs and iPhone Xs Max devices seem to be affected.
Users of the new iPhone models are complaining about charging problems. Many are reporting in Apple's official support forum that their iPhone Xs Max cannot be charged when locked. In isolated cases, the Xs models and older devices are also affected. The error occurs regardless of the cable. Affected devices must be connected while awake in order for the charging process to be activated. The problem does not occur with iPhones that are charged wirelessly.
iOS 12.1
Apple seems to have fixed this bug with the second beta of iOS 12.1. Users report flawless charging despite USB Restricted Mode being activated.
What caused the problem remains unclear. The final version of iOS 12.1 is expected later this year – possibly at the end of October.
Enable USB Restricted Mode
As soon as a device has been updated to iOS 11.4.1, the mode activates automatically. You can find it in the settings under "Touch ID & Passcode" (iPhone X "Face ID & Passcode"). The switch is deactivated by default, so the iPhone must first be unlocked so that USB accessories can connect if the iPhone has been locked for more than an hour. Charging the battery should always be possible.
https://www.apfelpatient.de/news/das-kommt-mit-ios-12-1-2222