Question: must unlock iphone to use accessories?
Answer: To disable USB Restricted Mode and let USB accessories function even while your device is locked, head to Settings > Touch ID & Passcode (or Face ID & Passcode). Enter your PIN to continue. In the “Allow Access When Locked” section, enable the “USB Accessories” option.