First, let’s attempt resolving this issue with your iOS device by trying a hard reset, then proceed from there if that does not resolve the problem:
Disconnect the iOS device from it's cord, if plugged in.
Press and hold your Sleep/Wake button (on the top) and Home button (on the front) together for around 10 seconds.
When the Apple logo appears, release both buttons.
Then try connecting it to the MacBook and see if it is recognized.
Shutdown your Mac.
Restart and, as soon as you hear the startup chime, hold COMMAND + R keys until you see the Apple logo and progress indicator (Alternative: press the “OPTION” key at boot and select the “Recovery HD" option in the menu).
Wait for “OS X Utilities” menu to appear (DO NOT CHOOSE TO INSTALL)
Choose Disk Utility from the available options.
In Disk Utility, select your normal, bootable hard drive volume from the list in the sidebar (usually "Macintosh HD").
Then, Click "Repair Disk"
If it finds errors, repeat the process until it reports the drive is OK.
Next, click "Repair Disk Permissions"
Then, restart your Mac and it should boot back into your normal Desktop.
Try the iPhone once more.
Hopefully, this info will answer your question and if so please don't forget to positively rate my service
. If you continue to have questions on this topic, just reply back to this discussion prior to rating. I will be more than happy to work with you further.
Thanks and good luck,