My MacBook Air won't charge
Because you explain the problem perfectly, and in short:
- The battery does not charge, and your Macbook does only work with MagSafe attached
There's only one option what could be the problem...
The battery is dead, let me explain you why:
- Your battery is ignored somehow, and your Macbook uses power directly from the MagSafe adapter. If you couldn't even use the Macbook with the cable in it, the cable could be the problem. Since it works with cable-attached, it's not.
- You can use the macbook with cable in it as explained above.
You seem to have a dead battery, you can check the status by going to Apple Menu > About this Mac > System Information > System Report
(10.7 or later, similar but different on older OS)
Your battery could die for a lot of reasons, it's simply been used a lot, or it's been damaged, or used in environmental conditions that are outside of it's operating spec etc. Check this link to see what a normal cycle count should be so you can at least see if yours has died from old age if nothing else.
You don't say what model of Air it is - if it's an original one, it may have an expected cycle count of as little as 300 (and even then, to acheive that you would have needed to have used it correctly in terms of not storing it with a full or empty charge, regularly fully depleting it etc). Batteries are weird. I had one go on my first Macbook seemingly simply because I left it flat for a month.