2

I am trying to prevent app from using dark mode because text becomes white on a white background

These solution for darkmode have not worked for me:

I add this to my Info.plist file: (this does nothing)

    <key>UIUserInterfaceStyle</key>
    <string>Light</string>

I tried this in my AppDelegate.m: (give me build errors)

    if (@available(iOS 13.0, *)) {
        rootView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    }
Currently_Lost
  • 100
  • 1
  • 9

2 Answers2

1

Instead of rootView you should use self.window. I fixed it this way:

if (@available(iOS 13, *)) {
    self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
Ankush Rishi
  • 2,861
  • 8
  • 27
  • 59
0

4 steps to solve this issue if you are using object c.

  1. Adding below string and key in info.plist
<key>UIUserInterfaceStyle</key> 
<string>Light</string>
  1. Open AppDelagate.m
  2. Find following line of code [self.window makeKeyAndVisible];
  3. And just paste below code
  [self.window makeKeyAndVisible];
  if (@available(iOS 13, *)) {
     self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
  }
Qamber
  • 108
  • 8