Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS keyboard extension SIGQUIT when launching

I'm implementing a keyboard extension. But sometimes it encounters SIGQUIT signal while launching.

The situation is as follows:

  1. Click the textView, and the keyboard appears
  2. Tap anything and hide the keyboard
  3. Change to another app
  4. Click the textView and wait for the keyboard to appear

CRASH!!! SIGQUIT

Exception Type:  EXC_CRASH (SIGQUIT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Signal: Quit: 3
Termination Reason: Namespace SIGNAL, Code 0x3
Terminating Process: launchd [1]
Triggered by Thread:  0
Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000018819b260 semaphore_wait_trap + 8
1   libdispatch.dylib               0x00000001880895e8 _os_semaphore_wait + 24
2   libdispatch.dylib               0x0000000188088ca0 _dispatch_semaphore_wait_slow + 140
3   DTXConnectionServices           0x00000001012a9ec4 0x10129c000 + 57028
4   DTXConnectionServices           0x00000001012a95ec 0x10129c000 + 54764
5   libfsmonitor_interpose.dylib    0x000000010128a040 0x101288000 + 8256
6   libfsmonitor_interpose.dylib    0x000000010128a3b4 0x101288000 + 9140
7   dyld                            0x00000001013326b0 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 356
8   dyld                            0x00000001013328e0 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 36
9   dyld                            0x000000010132db44 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 368
10  dyld                            0x000000010132cb74 ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 136
11  dyld                            0x000000010132cc30 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 84
12  dyld                            0x000000010131e440 dyld::initializeMainExecutable() + 140
13  dyld                            0x00000001013226bc dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 3640
14  dyld                            0x000000010131d044 _dyld_start + 68

In the Backtrace, It's all system call. The extension code is not really running! And every time the crash happens, the break points are all different.

I tried a lot of things, but none of them is helping.

Does anyone know the solutions?

like image 300
S.Captain Avatar asked Jul 17 '17 07:07

S.Captain


1 Answers

Usually, this means that iOS' launchd process terminated your keyboard due to some reasons of "misbehaving" (some info here). It's very often related to the startup time, so make sure that your keyboard starts quickly (ideally less than a second). You can use Instruments with time profiler: open an app with two text field and switch between them multiple times to get enough data. Note that backtraces in crash logs are useless in this case and don't show any reason for the crash (because it's not a crash - it's just signal sent my launchd which made your app QUIT)

Also, since iOS11 released this behaviour start happening more and more often and I'm assuming it's related to some issue with the logic of this checker.

like image 93
Stanislav Levental Avatar answered Nov 17 '22 15:11

Stanislav Levental