You're not required to use an iPhone with iTunes in macOS and Windows, but plenty of people still plug in to a computer via USB and rely on Apple’s music-management software to handle syncing, updates, and backups.
But what to do if you plug in and you see a message that says, “iTunes could not connect to this iPhone. You do not have permission.”
You’d think very reasonably that this would have something to do with whether your iPhone was unlocked in just the right way. Apple added a feature in iOS 11.4 to deter USB-based hacking of iPhones. The USB Restricted Mode feature prevents access to an iPhone’s data if it’s enabled and it’s been more than an hour since the last time the phone was unlocked.