Here's a cut&paste from my answer to a similar question. Basically, I would try everything below and replace the expansion port board if necessary, and if you can find it online somewhere. Since the Hero4 is relatively new, you may have a hard time finding the part.
This may be a little late for you, but I recently had saltwater damage on my GoPro Hero 3. I went (saltwater) snorkeling for 2 hours without the waterproof case. Here's what I did to fix it.
Remove the battery, back panel and side panel. As soon as possible, soak it in fresh water for a day, refreshing the water several times. Then soak it for a few hours or overnight in isopropyl alcohol. If there are any stickers inside the battery compartment or elsewhere that begin to peel/bubble and you care about keeping them intact, remove from the alcohol bath before they get too far gone. After removing from the alcohol bath, dry the best you can and use ifixit's guide to take it apart (buy the necessary tools if you need to). Take off the cover (pry) and remove the main assembly (4 screws). Use white vinegar applied with an acid or small paint brush to clean all visible electronics, contacts, and ports. Briefly rinse with water, then alcohol, using a clean acid brush to again clean out the ports. Use compressed air (or hair dryer w/out heat) to completely dry it.
Doing the above got the camera working again, but it wouldn't read any microSD cards, so I replaced the accessory board (as the ifixit teardown calls it) or expansion port board (as ifixit parts replacement calls it). This is the board with the microSD card slot, USB and HDMI ports, and expansion (LCD display) port. This part was $15 at ifixit - luckily they had the replacement part for the Hero3 in stock (it was used, but still worked).