Iphone XS turns off when charging and does not charge
Hello! My iphone (XS) turns off when charging and it does not charge. At first, when I plugged it into the outlet, it will signify that it is charging (with lightning symbol) but after few seconds, it turns off and won't charge. I cannot turn it on also. But once I removed the plug, it will automatically turn on and ask me to log in my Apple ID. Also, the battery is still in the last percentage where I last left it :(
iPhone XS, iOS 16