IPhone not charging when Macbook lid is closed?

I'm having an issue I never had before with my macbook air and iphone 5s. I put the phone to charge and it works fine when the macbook air lid is open and I'm actively using the computer. Then, when I close the lid, it'll charge for a few seconds and then just stop. It even happens when I leave the computer unattended and the screen turns black, the phone will stop charging. I suspect it has something to do with the computer and a certain setting I have it set to, but I'm not sure. If anyone has an answer, I'm not very good at technology haha.

Closing the lid powers off the charging ports.

Try connecting your laptop's power cord; then connect your phone to the USB port; then close the laptop
.
Does it continue to charge your phone?

When you close the lid, it puts the computer to sleep, which is a low power mode. In that mode, all power is stopped, including the USB ports.
you would need to change the setting for it NOT to go to sleep if you want it to continue charging.
or… Just get a wall charger. They are cheap, and do a better FASTER job of charging your phone than the computer does…
you should only charge from your computer USB port when you are away from home, in a location that does not have wall power outlets.

"IPhone 5s not charging when Macbook Air lid is closed"

That's called sleep.

"leave the computer unattended and the screen turns black"

That also is called sleep. The screen also turns black when you close the lid, but like the fridge light, you can't see what happens when closed.

Try in Safe Boot…
- Restart while holding the shift key for 30 seconds.
- Log in.
- Test USB port in sleep.

If that works, you have installed some software that interferes with USB function.

  • IPhone charging cable not supported but still charging? I have a genuine Apple cable that came with my iPhone 6 (updated to the latest iOS). It fully charges up but when it gets to 100% I get a message that says "this accessory may not be supported". I don't see any damage to the cable and I have only had it a couple of months. Not sure whether to just ignore it or not?
  • Iphone app stays half visible on screen after closed? I noticed that my iphone 6 ios 8.3 has the an app that has been used previously still visible on the screen like half visible. I tried to restart my phone seceral times but it's still there. What can i do to fix this problem?
  • IPhone 5 charging, then not charging? I plug in my phone and it charges and then stops charging. So it's like constantly vibrating. I just got a new cable so I don't think that's it. No water damage. Any ideas? Or a quick, SAFE fix until I can get it looked at. I leave for camp tomorrow or I'd go do it then.
  • Iphone 3gs not getting charging - charging not supported? I'm having a i phone 3gs at times, it gives me message like charging not supported with this accessory when i tried to charge it i tried this with many differnt charging wires. But same in everything./ i tried restarting my PC and i phone thinking some issue with USB port or phone still the same. how do i fix this