Charger, charging port one of the reasons, first test the charger, if normal, then clean up the charging port, see if it is blocked by dirty things, or it is the tail plug problem, it is recommended to replace
Apple xS can not be charged, it is likely that the battery is broken and can be repaired, and the battery needs to be replaced with a new battery.