You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I’m trying to update the User-Agent in my iOS/macOS app, but it doesn’t seem to take effect. Even after setting the new value in NSUserDefaults, the web requests still use the old User-Agent.
Steps to Reproduce:
Set a new User-Agent in NSUserDefaults:
[[NSUserDefaults standardUserDefaults] setObject:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0"
forKey:@"UserAgent"];
[[NSUserDefaults standardUserDefaults] synchronize];
Expected Behavior:
The User-Agent should update immediately after restarting the app.
WKWebView and network requests should use the new User-Agent.
Actual Behavior:
The User-Agent remains the same as before.
The system does not seem to apply the changes.
Additional Notes:
I tried using registerDefaults: and setObject: but neither worked.
Restarting the app did not help.
Clearing cache with [[NSURLCache sharedURLCache] removeAllCachedResponses]; had no effect.
WKWebView.customUserAgent also does not seem to change the actual requests.
The text was updated successfully, but these errors were encountered:
Description:
I’m trying to update the User-Agent in my iOS/macOS app, but it doesn’t seem to take effect. Even after setting the new value in NSUserDefaults, the web requests still use the old User-Agent.
Steps to Reproduce:
Set a new User-Agent in NSUserDefaults:
Expected Behavior:
The User-Agent should update immediately after restarting the app.
WKWebView and network requests should use the new User-Agent.
Actual Behavior:
The User-Agent remains the same as before.
The system does not seem to apply the changes.
Additional Notes:
I tried using registerDefaults: and setObject: but neither worked.
Restarting the app did not help.
Clearing cache with [[NSURLCache sharedURLCache] removeAllCachedResponses]; had no effect.
WKWebView.customUserAgent also does not seem to change the actual requests.
The text was updated successfully, but these errors were encountered: