The following worked for me. This is from https://macreports.com/iphone-keeps-connecting-and-disconnecting-from-mac-fix/ 

On the Mac, open the terminal, 

     sudo killall -STOP -c usbd

This will restart the USB daemon on Mac. After this, my phone asked for 'Trust' only once.