Beginning with iOS 12, you always have to unlock your iPhone or iPad to connect a USB accessory because of the “USB Restricted Mode” that protects your device from hacking tools such as GrayKey.
The reason you see this Message
GrayKey has been exploiting USB connections to crack PIN protection on iPhones and iPads. To prevent this, Apple restricts USB devices from gaining access to data connection when your iPhone or iPad is unlocked. Connecting a USB device to your iPhone or iPad when the restricted mode is active brings a notification that says, “Unlock iPhone to use accessories” or “Unlock iPad to use accessories.” However, this security feature can be disabled.
iOS 12 Removes the One Hour Grace Period
When Apple originally added this feature to iOS 11.4.1, there was a grace period of one hour. As long as your iPhone or iPad was unlocked within the last hour, any USB device could connect to your phone. The reason was so that the annoyance having to unlock the device would bring will be reduced a bit.
However, in the iOS 12 beta, Apple seems to be removing this grace period for fear that it could be exploited. If your iPhone or iPad is locked, you must unlock it before any USB device can gain connection.
Disabling USB Restricted Mode
- Head to Settings and from there click on Touch ID & Passcode (or Face ID & Passcode).
- Enter your PIN to continue.
- In the “Allow Access When Locked” area, enable the “USB Accessories” option. When this option is enabled, devices are able to connect to your iPhone or iPad even when it is locked.
That being said, enabling this feature is not something we recommend since it protects your private data from hacking tools.