TL;DR
No. We can't toggle user consent locally without Apple. i.e., the consent status now for Analytics has a single source of truth (Source).
Tracking consent without Apple's Framework
If I have not received permission from a user via the tracking
permission prompt, can I use an identifier other than the IDFA (for
example, a hashed email address or hashed phone number) to track that
user?
No. You will need to receive the user’s permission through the
AppTrackingTransparency framework to track that user.
Tracking consent with a Website instead
If a user provides permission for tracking via a separate process on
our website, but declines permission in the app tracking transparency
prompt, can I track that user across apps and websites owned by other
companies?
Developers must get permission via the app tracking
transparency prompt for data that’s collected in the app and used for
tracking. Data collected separately, outside of the app and not
related to the app, is not in scope.
Alternative
The iOS Settings -> Privacy -> Tracking menu from within an app is not accessible because URL schemes to Settings were deprecated in iOS 10+.
But you don't need to go that far:
if let appSettings = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(appSettings, options: [:], completionHandler: nil)
}
The app page in Settings also has the option to toggle consent just for your app. Remember to track your consent status with Apple's consent for every app launch since the user can change this value at any time. For more info, see here.