-2

I will explain my problem.

I realised an iphone application. When I was on simulator in Xcode all was good. But when I tried to test on real device stanger things happened. i have no iphone but I have an apple developer account. I put my build on Testflight and ask colleagues to test my app. The first one with an Iphone 11, test it and it worked like a charm. The second one with an Iphone 8 test it and there are many problems. Labels don't display. It's like the pages had just the title. On some pages, the background become black whereas it should be white. I don't understand. Both iphone are on ios 13 or older. I don't why. In simulator, iphone 8 and iphone 11 works.

Anyone have an idea why it happens and how we can correct that. Thanks a lot and have a nice day.

THIBAULT Nicolas
  • 159
  • 3
  • 11
  • I see 2 downvotes but no responses. Can you tell me what informations do you like I add concerning this problem ? – THIBAULT Nicolas Mar 17 '20 at 16:13
  • Please add your screenshots of iphone 11 and iphone 8 views. The screenshots like what you want to achieve and what you axactly got. – Jignesh Mayani Mar 18 '20 at 11:24
  • Thanks a lot for your response. I find this morning the problem. When the phone was on dark side, my text doesn't appear and the color change. – THIBAULT Nicolas Mar 18 '20 at 13:28
  • It wasn't a code problem. This was the fact that the iphone is in dark mode. – THIBAULT Nicolas Mar 18 '20 at 13:28
  • You checked that your screen colour and text working perfectly in light mode? – Jignesh Mayani Mar 18 '20 at 13:31
  • At the beginning, my emulator was on light mode on all was ok. On the iphone 11 that I test, it was also in light mode. But I discovered this morning that the iphone8 was on dark mode. Therefore all colours was not okay. I force the light mode in info.plist and it works like a charm. – THIBAULT Nicolas Mar 18 '20 at 13:33

1 Answers1

1

1 Method : if you want to use dark mode then you can change the colours as aspected in the dark mode like this

 if #available(iOS 12.0, *)
    {
        if self.traitCollection.userInterfaceStyle == .dark
        {
            self.view.backgroundColor = .white
        }
        else
        {
            self.view.backgroundColor = .black
        }
    }
    else
    {
        self.view.backgroundColor = .black
    }

2. Method : If you want your colours as aspected in the light mode. Then you must add below line in the info.plist file

<key>UIUserInterfaceStyle</key>
<string>Light</string>
Jignesh Mayani
  • 6,937
  • 1
  • 20
  • 36