Some devices running iOS 12 have a report that charging will not start if sleep mode is active while Lightning cable is connected.
This problem was first pointed out at iPhone XS Max, but it is clearly occurring in various models of Apple.
If the device is awake while the cable is connected, there is no problem with charging. It is displayed only when the screen of the mobile phone or tablet is off.
Everyone is not concerned about charging the iPhone
This problem does not occur on all devices running iOS 12. Unbox Therapy I ran tests on nine different units such as iPhone X, iPhone XS, iPhone XS Max, but the results were very contradictory. Sometimes the device ran normally and went back from sleep long enough to start charging. Other handsets under test ignored the cable being installed at all. Some of these start charging when you wake up by tapping the screen.
A Mack cult iPhone XS Max does not have this problem, but iOS 12.1 Beta 1 is running. This means that this problem does not occur on 12.9 inch iPad Pro with iOS 12.
Probably USB Safe Mode problem
There were no reports of similar problems with wireless charging. Only when using lighting cable. This increases the likelihood that the problem is related to the USB safe mode. This is the first feature added in iOS 11.4.1, partially disabling the Lightning port after the iPhone has not been used for one hour.
After pausing for 60 minutes, the port is supposed to ignore the accessory attempting to transfer data. The goal is to block with the "brute force" the unlock tool of iPhone used by hackers and police. However, Apple warns that there may be problems with billing in USB safe mode.
Noting that this iPhone charging issue is addressed, Apple is almost certainly working on fixing it. Please wake up the iPhone in the meantime and then connect the Lightning cable and charge.