Cleaning an Apple charging cable? Keep connectors dry and wait overnight
Apple recommends unplugging both ends, wiping the cable with a slightly damp lint-free cloth, keeping moisture away from connectors and allowing overnight drying.
Spraying cleaners onto a dirty cable can carry liquid toward electrical connectors. Apple's own guide describes a cloth-only cleaning method and thorough drying for Apple and Beats cables; check other makers' instructions separately.