This is driving me insane. I have this issue. First trip to the dealer and they said a fuse was busted. Reset the fuses, gave me the truck, I checked on exit and it wasn't working. Made an appointment while there for the media hub to be replaced.
After having the media hub replaced, everything was fine for about 4 days before the problem intermittently returned. I've tried about 10 different devices, several apple certified cables and different ports, but the problem won't go away. The dealership just shrugged and said what can we do, we did everything we know to fix.
If anyone finds a permanent solution, pls post. It's super annoying to go from being carplay dependent for nav/SMS/calling to having it be unreliable.