Skip to content

Commit

Permalink
Add post
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Dec 18, 2023
1 parent 5c71dde commit abd25cd
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/kankoda/licenses/terms.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## License Details

A license is valid for one product, defined by the bundle ID that is provided at the time of purchase.
The license is valid for one product, as defined by the bundle IDs that is provided during purchase.


### License Activation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Critical extension crashes in iOS 17.1
date: 2023-12-10 08:00:00 +0100
tags: general

image: /assets/headers/icon.png
---

This blog post contains important information about a keyboard extension crash that may occur in production in iOS 17.1 (and perhaps even in iOS 17.0).

![KeyboardKit logo]({{page.image}})

Some developers have reported that their keyboard extensions crash on launch in production. The same has been observed for the [KeyboardKit app](/app).

When this crash happens in production, nothing is reported to Xcode. This means that you will get not indication that the your keyboard extension is crashing for your users.

When this crash happens in Xcode, attaching the debugger to your keyboard extension will not work. The keyboard extension will crash before being attached to the debugger.


## Not caused by KeyboardKit

The crash has been thoroughly investigated by completely removing KeyboardKit from the crashing keyboard. The crash still occurred, without KeyboardKit being used by the keyboard.


## Crash behavior

When attaching the Xcode debugger to the keyboard extension before launching it, this was logged to the Xcode console when the crash occured:

```
[u FAED32EA-0D37-40FE-918D-75FACBBF2D30:m ] [com.xxx(2.4.1)] Failed to start plugin; plugin is already activating
[u FAED32EA-0D37-40FE-918D-75FACBBF2D30:m ] [com.xxx(2.4.1)] Failed to start plugin; pkd returned an error: Error Domain=PlugInKit Code=4 "RBSLaunchRequest error trying to launch plugin com.xxx(FAED32EA-0D37-40FE-918D-75FACBBF2D30): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7acdc5ef0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}" UserInfo={NSLocalizedDescription=RBSLaunchRequest error trying to launch plugin com.xxx(FAED32EA-0D37-40FE-918D-75FACBBF2D30): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7acdc5ef0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}
Plugin <id<PKPlugIn>: 0x157f22900; core = <[u FAED32EA-0D37-40FE-918D-75FACBBF2D30] [com.xxx(2.4.1)],[d 6D82DCED-06E7-4422-851A-07682868277E] [/private/var/containers/Bundle/Application/56E42C13-6DDF-4C17-B363-36C0BF5A2AA4/KeyboardKit.app/PlugIns/Keyboard.appex]>, instance = [(null)], state = 3, useCount = 0> must have pid! Extension request will fail
Failed to acquire assertion for plugin: <id<PKPlugIn>: 0x157f22900; core = <[u FAED32EA-0D37-40FE-918D-75FACBBF2D30] [com.xxx(2.4.1)],[d 6D82DCED-06E7-4422-851A-07682868277E] [/private/var/containers/Bundle/Application/56E42C13-6DDF-4C17-B363-36C0BF5A2AA4/KeyboardKit.app/PlugIns/Keyboard.appex]>, instance = [(null)], state = 3, useCount = 0> pid: 0
Unable to acquire process assertion in beginUsing: with plugin identifier: com.xxx, killing plugin
begin extension request <EXExtensionRequest: 0x282359ff0> Request PK UUID: 40E96D77-4481-42BD-BFEC-17A912AC60C3 with item count 0 complete with error: Error Domain=PlugInKit Code=4 "RBSLaunchRequest error trying to launch plugin com.xxx(FAED32EA-0D37-40FE-918D-75FACBBF2D30): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7acdc5ef0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}" UserInfo={NSLocalizedDescription=RBSLaunchRequest error trying to launch plugin com.xxx(FAED32EA-0D37-40FE-918D-75FACBBF2D30): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7acdc5ef0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}
PlugInKit error in beginUsing: with plugin identifier: com.xxx, killing plugin
CAReportingClient.mm:532 Attempted to remove a reporter not created by this client { careporter_id=66 894 115 635 204 }
```

In the log messages above, `com.xxx` is the bundle ID of the keyboard.

The reason for the crash seems to be that the system fails to start the plugin (extension) altogether, not that the keyboard extension crashes.

When investigating the crash, the keyboard extension could sometimes be launched once, but any subsequent launches or deploys from Xcode would then cause it to crash again.

When the keyboard was crashing from Xcode, installing it from App Store or TestFlight would make it work. However, if an App Store or TestFlight build would crash, the app had to be reinstalled.

When the keyboard was crashing, toggling Full Access would sometimes make the next launch work, but any subsequent launches or deploys from Xcode would then cause it to crash again.


## Conclusion

After many hours of trying to find an explanation to this crash, both test devices were updated to iOS 17.2. After that, the crash completely went away on both devices.

It seems like the reason for this crash is that iOS 17.1 (not confirmed on iOS 17.0) for some reason fails to launch keyboard extensions multiple times in a row.

If this observation is correct, and the crash will happen on launch, there is unfortunately little you can do to work around the problem.

One alternative is to add a critical error message to your main app and ask users that are on iOS 17.1 (and maybe even 17.0) to update their device to iOS 17.2.

0 comments on commit abd25cd

Please sign in to comment.