divvun / giellakbd-ios

Open source reimplementation of iOS keyboard with localisation support
Apache License 2.0
29 stars 5 forks source link

Keyboards crashing #228

Closed bbqsrc closed 4 months ago

bbqsrc commented 5 months ago

Seems to have started happening in the last 5 days or so.

snomos commented 5 months ago

Permission thing?

dylanhand commented 5 months ago

As of iOS 17.4, some keyboards are crashing:

🔴 These crash:

🟢 These do not crash:

On iOS 17.3.1, only the Kildin Sami keyboard crashes.

Not sure what's causing this, but I remember noticing issues when testing with a phones running iOS 17.4. In the limited on-device testing I've done in the last month I've had to use iOS 17.3.x. Will look into it.

dylanhand commented 5 months ago

This might be a bug with iOS 17.4.

When running via Xcode and attached device running iOS 17.4 or 17.4.1, the keyboard extension crashes before the debugger attaches. Even adding a print statement in init(nibName:bundle:) function in EntryPoint.swift, where it all starts, doesn't run before it crashes. Nor do the log statements in init.m which run even before EntryPoint.swift.

Crash log is:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: objects argument is not an NSArray'
*** First throw call stack:
(0x18ed76b28 0x186be6f78 0x18ece9b08 0x18ece9694 0x19912d848 0x19912dba8 0x19912db20 0x19912d888 0x19912d648 0x19912d8a8 0x19912dbfc 0x19912db20 0x19912d888 0x19912d648 0x19912d8a8 0x19912dbfc 0x19912db20 0x19912d888 0x19912d648 0x19912d8a8 0x19912dbfc 0x19912db20 0x19912d888 0x19912d648 0x19912d8a8 0x19912dbfc 0x19912db20 0x19912d888 0x19912d648 0x19912d8a8 0x19912dbfc 0x19912db20 0x19912d888 0x19912ed84 0x1919b2d64 0x1919b250c 0x1912149c4 0x191b2cae8 0x191b2c984 0x191214340 0x191214224 0x1912140cc 0x191213fe8 0x191b2c8a0 0x1919c09b8 0x1919c1024 0x1919c9238 0x1919c2bbc 0x191ba36bc 0x191ba3c44 0x191b25824 0x191d37f78 0x1916cc698 0x1916cca10 0x1916c9f0c 0x1916cba78 0x1911074c0 0x191106e64 0x1911060e4 0x1910c8970 0x1910c7010 0x1910c5a1c 0x190fb0d78 0x190fb0468 0x190fb0524 0x18ecc162c 0x18ecc08a8 0x18ecbf058 0x18ecbdd88 0x18ecbd968 0x1d2fbb4e0 0x191130edc 0x191130518 0x100400484 0x1b21ded84)
libc++abi: terminating due to uncaught exception of type NSException

Running on a device with iOS 17.3.1 works as expected.

It looks like this might not be the first time iOS 17 broke keyboard extensions: https://keyboardkit.com/blog/2023/12/10/critical-extension-crashes-in-ios-17-1

Not sure there's anything we can do about this since it's not possible to set breakpoints or print statements. Open to wild ideas if anyone has them.

One idea is to create a new blank keyboard extension project to see if that also crashes on iOS 17.4.

snomos commented 5 months ago

One idea is to create a new blank keyboard extension project to see if that also crashes on iOS 17.4.

Yes, please do, just to confirm that the bug is with iOS.

But why is it that only some keyboards crash? And all of them Sámi? What is different compared to the non-crashing ones?

dylanhand commented 5 months ago

But why is it that only some keyboards crash? And all of them Sámi? What is different compared to the non-crashing ones?

Great question. I would have assumed that indicates it has something to do with the layout in KeyboardDefinitions.json, but in my tests it crashes before that file is loaded.

Another thought is that Apple recently added native Sami keyboards to iOS and macOS, so perhaps there's some conflict there? Seems unlikely.

Creating a new, blank, keyboard extension project works.

I'll keep digging.

@snomos I'm assuming this takes priority over upgrading the macOS builders. Let me know if not.

snomos commented 5 months ago

@snomos I'm assuming this takes priority over upgrading the macOS builders. Let me know if not.

Yes. Crashing bugs in production systems always take priority.

snomos commented 5 months ago

Tested on iPadOS 17.4.1, this is the result I get:

🔴 These crash:

🟢 These do not crash:

That is, ONLY Kildin Sámi is crashing on iPadOS 17.4.1. For what it is worth, it is the only Sámi keyboard that is not using the Latin script.

dylanhand commented 5 months ago

Tested on iPadOS 17.4.1, this is the result I get:

🔴 These crash:

* SJD/Kildin Sami (and also takes down the app, Notes in my example)

🟢 These do not crash:

* SME/Northern Sami
* SMN/Inari Sami
* SMS/Skolt Sami
* SMA/South Sami
* SMJ-NO/Lule Sami (Norway)
* SMJ-SE/Lule Sami (Sweden)
* SJE/Pite Sami
* SJU/Ume Sami

That is, ONLY Kildin Sámi is crashing on iPadOS 17.4.1. For what it is worth, it is the only Sámi keyboard that is not using the Latin script.

Interesting - this is the same result I see on iOS 17.3.1.

snomos commented 5 months ago

Tested on iPadOS 17.4.1, this is the result I get: 🔴 These crash:

* SJD/Kildin Sami (and also takes down the app, Notes in my example)

🟢 These do not crash:

* SME/Northern Sami
* SMN/Inari Sami
* SMS/Skolt Sami
* SMA/South Sami
* SMJ-NO/Lule Sami (Norway)
* SMJ-SE/Lule Sami (Sweden)
* SJE/Pite Sami
* SJU/Ume Sami

That is, ONLY Kildin Sámi is crashing on iPadOS 17.4.1. For what it is worth, it is the only Sámi keyboard that is not using the Latin script.

Interesting - this is the same result I see on iOS 17.3.1.

And the same result I get on my iPhone with iOS 17.3.1.

snomos commented 5 months ago

Now tested the same iPad as above, but with iOS 17.5 beta:

The keyboard DOES NOT crash, not even in the case of Kildin Sámi. It thus seems to be a bug in the OS that has been fixed in the 17.5 beta release. I will still test the same on an iPhone.

snomos commented 5 months ago

Just to confirm:

Now tested on an iPhone with iOS 17.4.1. Most Sámi languages crash, except Lule Sámi (SMJ) and North Sámi (SE/SME). Why SME works for me but crashes for others, I don't know. The only thing I can think of is that the SME keyboard was already the active/selected keyboard from before the upgrade to 17.4.1. — Yup, that seems to be the case. After switching to SMJ, and then switching back to SME, SME crashes as well.

So the behaviour is exactly as @dylanhand has reported.

Next step: update the phone to the iOS 17.5 beta, and test again.

snomos commented 5 months ago

Short update for the record:

@dylanhand will test iOS 17.5 beta on a suitable device.

dylanhand commented 5 months ago

Unfortunately, as of iOS 17.5 beta (21F5048f), I get the same result as iOS 17.4. Many Sami keyboards crash, namely:

🔴 These crash:

🟢 These do not crash:

snomos commented 5 months ago

Time to mail Apple then.

snomos commented 5 months ago

Could you test the rest of the Sámi keyboards?

dylanhand commented 5 months ago

Could you test the rest of the Sámi keyboards?

* Pite

* Ume

Both crash.

Note that I used the Divvun Dev Keyboards app for these. I used the Divvun Keyboards app from the App Store for all others.

snomos commented 5 months ago

Thanks for testing. I have tested using the Divvun Dev Keyboards app for all Sámi keyboards.

dylanhand commented 5 months ago

Just to be sure, I re-tested the previously-listed-as-crashing keyboards in Divvun Dev Keyboards app.

They crash there too using iOS 17.5 beta (21F5048f).

dylanhand commented 4 months ago

The latest build of Divvun Dev Keyboards 0.2.7 (223), which adds privacy declarations (#230), still crashes using iOS 17.5 Beta 1 (21F5048f).

It is also crashing using iOS 17.5 Beta 2 (21F5058e).

snomos commented 4 months ago

Update for the sake of bookkeeping: the bug has been reported to Apple, and they have confirmed the bug. It is fixed in the latest beta of iPadOS, but is still there in the latest iOS beta.

This bug is thus on the Apple side of things, and there is little we can do except hope that they fix it.

I'll keep this issue open until we have confirmation that it is really fixed by Apple.

snomos commented 4 months ago

Apple yesterday released iOS iPadOS 17.5, and after updating my phone, and all keyboards that did crash earlier do not crash anymore. This bug is thus fixed (by Apple). Closing this.

dylanhand commented 4 months ago

Can confirm this is working on my device running iOS 17.5 as well.