A few days ago I upgraded Xcode 11 to Xcode 12, since than my app doesn't build correctly. One of the problems is that my white uitextfields become black! In the image below it should show 4 uitextfields inside the red rectangle as a stack, but now you see nothing, because they turned black (The are not disappeared)! I haven't changed anything, just upgraded Xcode to release version 12. I tested on iOS 12.x, iOS 13.x and iOS 14, on all versions uitextfields turn black now, just because I use Xcode 12.
All my uitextfields turned black. My app doesn't support dark mode, but I had no problems in Xcode 11.4.
I also tried to fix the problem with the following code:
if (@available(iOS 13.0, *)) {
if ([self.window respondsToSelector:NSSelectorFromString(@"overrideUserInterfaceStyle")]) {
[self.window setValue:@(UIUserInterfaceStyleLight) forKey:@"overrideUserInterfaceStyle"];
}
}
But with no success :(
The only solution is to manually set all the uitextfields' background to white, but that's frustrating. Do you know what causes the uitextfields to be black instead of default white and how I can fix it from central place?
I had a similar problem in an application and according to Apple documentation you can try add same "ligth" style for all your screens added the next line to your Info.plist file of your application
Setting this key to Light causes the system to ignore the user's preference and always apply a light appearance to your app.
Important
Supporting Dark Mode is strongly encouraged. Use the UIUserInterfaceStyle key to opt out only temporarily while you work on improvements to your app's Dark Mode support.
Reference: https://developer.apple.com/documentation/xcode/supporting_dark_mode_in_your_interface/choosing_a_specific_interface_style_for_your_ios_app