When connecting your iPhone or iPad to a computer using iTunes from iOS version 11.4.1 onwards, the device will show the Unlock iPhone to Use Accessories warning. This feature prevents your device from transmitting or accessing data through other devices or vice versa. For devices with Lightning ports, you can still charge the battery, but certain tasks cannot be performed.
Deactivate the reminder notification on iPhone when accessing other devices.
Discover a Stylish Way to Hide Unlock iPhone to Use Accessories Notification on iPhone
Follow Step 1: Access the Settings on your iPhone or iPad.
Step 2: In the following window, choose either Touch ID & Passcode or on some devices, Face ID & Passcode.
Step 3: If your device prompts for a password, enter it; otherwise, proceed to Step 4 below.
Step 4: Next, scroll down and locate the USB Accessories option, then proceed to turn ON this mode.
Once this mode is activated, your iPhone or iPad device can connect or access data with other devices even when locked. You won't see the prompt 'Unlock iPhone to Use Accessory' anymore when connecting to Mac, PC, or any other USB-enabled accessory.
A note for you is that Apple designed this feature to protect your privacy on your iPhone or iPad. If you don't have much need to connect to other devices for data transfer, it's advisable not to disable this feature.
After following the above steps, you probably know how to hide the Unlock iPhone to Use Accessory notification by now. The steps are simple and easy to follow. Additionally, you can explore how to turn off iOS update notifications on iPhone and iPad to avoid seeing this notification every time there's a new iOS version.