If in the device settings the Screen Time option is enabled, go to Settings > Screen Time > Content & Privacy Restrictions > Content Restrictions > Screen Recording and make sure that the “Allow” option is enabled.