To make sure this is not an issue with the Mac, first reset the System Management Controller of your Mac. Follow the steps below;
Shut down the computer.
Plug in the MagSafe power adapter to a power source, connecting it to the Mac if not already connected.
On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
Release all the keys and the power button at the same time.
Press the power button to turn on the computer.
If that didn't work, then reset the PRAM and NVRAM of your Mac. Follow the steps below;
Shut down your Mac
Restart and immediately hold down Command-Option-P-R keys at the same time
Hold the keys down until the computer restarts and you hear the startup sound for two or three times.
Release the keys and let the Mac bootup.
Check iPhone. Does it work now ?