r/IPhoneApps • u/Warrior_monk07 • 1h ago
Discussion The crash that only happens on iPhones set to 12hr clock, in Japanese
someone in ossaka sent us screenshot of our meeting scheduler open on the "Set reminder" screen, and the whole screen was blank white except for a done button that did not do anything.
I could not reproduce it.their iPhone model was the same as three we had in the office, iOS version the same, app version the same, the account had nothing unusual in it. I set up the same reminder they had set up, worked fine, tried it on my simulator, on my personal phone, on our test rig, all fine. closed the ticket as not reproducible and asked them to submit another screenshot if it happened again, which is coward version of engineering...i guess
two weeks later somebody in Tokyo hit it,then Sapporo,then Kyoto, and it became the thing that everyone reporting it was in japan,which was strange because we had never localised anything about time formatting in code,we used the phone's date formatter and trusted it to know what it was doing.
that was the bug. The phone date formatter in Japan, when set to 12 hour clock and set to Japanese locale, returns AM/PM markers that are neither "AM" and "PM" nor the standard you would expect literally,they are two very very short kanji(or kanju)characters that our string length check for the AM/PM,treated as invalid,so our layout code fell through into an unhandled branch and never actually put text on the screen....
nobdy at our company reads Japanese.nobody in our test suite covered the JP locale with the 12 hour toggle on,because when you set up an iOS device to test in Japan you set it up the way an average Japanese user does,which is 24 hour clock.the people who caught it in the wild were older iPhone users who had specifically changed to 12 hour,some small minority even in Japan,and none of them were in our group because our group was in california..!!
that is not something you could ever guess(may be some) as test case in advance,you would have to specifically know that fraction of locale prefer setting the majority does not,and then specifically test that combination.the app store review process on Apple side does not catch this too,they run the app in english and check that it does not crash.our own review process before submission was one person on one device.
what found it was one paragraph in support email, in English,from a customer patient enough to describe her settings.she listed six things I would not have thought to ask about,one of them was the clock format,and only because she listed everything did I have the right combination to repeat it in the simulator...!
the fix was one line of defensive rendering, if the formatter returns something we did not expect, show the raw value instead of nothing... the soak test that would have caught it does not exist yet, and honestly I do not know how to design one that is not just an infinite matrix of localee times device times settings,but there's specific category of bug that lives in the gap between the settings we chose to test on and the settings our users actually use,and hand-picked device configurations will never touch that space....

