I have MacBook Air I want to connect my iPhone to it with my charger but when I do trust this computer the code won't show on the computer?

I have MacBook Air I want to connect my iPhone to it with my charger but when I do trust this computer the code won't show on the computer?

Try a different cable.

The USB data wires may have failed at some time with use, they are often thinner and more fragile than the two power wires than it uses for charging.