IOS 9 keyboard: this app modifies the autorun mechanism from the background thread, which can lead to engine damage and strange crashes

when I launch a third-party keyboard from a text view embedded in a web view, sometimes this may cause the application to crash.

Some information can be found when the application crashes:

  • There is always a warning, but if the keyboard is displayed successfully, a warning can also be shown.

"Sep 25 16:44:09 iPhone6-golden XXX [2916]: This application modifies the autorun mechanism from the background thread, which can lead to engine damage and strange crashes. This will lead to an exception in a future version. " "

Stack:(
        0   CoreFoundation                      0x00000001836f4f74 <redacted> + 148
        1   libobjc.A.dylib                     0x00000001982e7f80 objc_exception_throw + 56
        2   CoreFoundation                      0x00000001836f4ea4 <redacted> + 0
        3   Foundation                          0x000000018470e5d8 <redacted> + 88
        4   Foundation                          0x0000000184594f3c <redacted> + 56
        5   Foundation                          0x0000000184590afc <redacted> + 260
        6   UIKit                               0x0000000188d4f958 <redacted> + 64
        7   UIKit                               0x0000000188d50470 <redacted> + 244
        8   UIKit                               0x0000000188d6cf44 <redacted> + 108
        9   UIKit                               0x0000000189476798 <redacted> + 268
        10  UIKit                               0x0000000188f4dfcc <redacted> + 176
        11  UIKit                               0x0000000188f3d0b4 <redacted> + 52
        12  UIKit                               0x0000000188c4700c <redacted> + 644
        13  QuartzCore                          0x000000018844df14 <redacted> + 148
        14  QuartzCore                          0x0000000188448b20 <redacted> + 292
        15  QuartzCore                          0x00000001884489e0 <redacted> + 32
        16  QuartzCore                          0x000000018844807c <redacted> + 252
        17  QuartzCore                          0x0000000188447dd0 <redacted> + 516
        18  QuartzCore                          0x0000000188476f48 <redacted> + 236
        19  libsystem_pthread.dylib             0x0000000198cf61e8 <redacted> + 584
        20  libsystem_pthread.dylib             0x0000000198cf5d60 <redacted> + 136
        21  libsystem_pthread.dylib             0x0000000198cf7b48 pthread_sigmask + 0
        22  libsystem_pthread.dylib             0x0000000198cf7aa0 <redacted> + 0
        23  libsystem_pthread.dylib             0x0000000198cf5030 thread_start + 4
    )
  1. , . Xcode.

    : EXC_CRASH (SIGABRT) : 0x0000000000000000, 0x0000000000000000 : EXC_CORPSE_NOTIFY : 18 syslog:

    Last Exception Backtrace:
    0   CoreFoundation                  0x183f20f5c __exceptionPreprocess + 124
    1   libobjc.A.dylib                 0x198b13f80 objc_exception_throw + 56
    2   CoreFoundation                  0x183f20e2c +[NSException raise:format:arguments:] + 108
    3   Foundation                      0x184e0ff3c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
    4   UIKit                           0x1897130e8 -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:] + 200
    5   UIKit                           0x1897131ac -[UIApplication _systemAnimationFenceCreatingIfNecessary:] + 24
    6   UIKit                           0x1897653cc +[UIWindow _synchronizedDrawingFence] + 116
    7   UIKit                           0x189c137a4 -[_UIRemoteViewController synchronizeAnimationsInActions:] + 124
    8   UIKit                           0x189c0e158 -[_UISizeTrackingView _geometryChanges:forAncestor:] + 540
    9   UIKit                           0x189775fc8 -[UIView _notifyGeometryObserversWithChangeInfo:] + 272
    10  UIKit                           0x1894d36b4 -[UIView setCenter:] + 408
    11  UIKit                           0x18957ea40 -[UIView(Geometry) _applyISEngineLayoutValues] + 600
    12  UIKit                           0x18948e6b8 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 136
    13  CoreFoundation                  0x183e17ab0 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 132
    14  CoreFoundation                  0x183e179a8 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 308
    15  UIKit                           0x18947d3e8 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 116
    16  UIKit                           0x18957eb88 -[UIView(AdditionalLayoutSupport) _is_layout] + 128
    17  UIKit                           0x18977a210 -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 756
    18  UIKit                           0x18947300c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 644
    19  QuartzCore                      0x188c79f14 -[CALayer layoutSublayers] + 148
    20  QuartzCore                      0x188c74b20 CA::Layer::layout_if_needed(CA::Transaction*) + 292
    21  QuartzCore                      0x188c749e0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
    22  QuartzCore                      0x188c7407c CA::Context::commit_transaction(CA::Transaction*) + 252
    23  QuartzCore                      0x188c73dd0 CA::Transaction::commit() + 516
    24  QuartzCore                      0x188c6d4bc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
    25  CoreFoundation                  0x183ed7c30 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
    26  CoreFoundation                  0x183ed59d4 __CFRunLoopDoObservers + 372
    27  CoreFoundation                  0x183e04de0 CFRunLoopRunSpecific + 416
    28  WebCore                         0x195a69aa0 RunWebThread(void*) + 456
    29  libsystem_pthread.dylib         0x199523b3c _pthread_body + 156
    30  libsystem_pthread.dylib         0x199523aa0 _pthread_start + 156
    31  libsystem_pthread.dylib         0x199521030 thread_start + 4
    
    Thread 18 name:  WebThread
    Thread 18 Crashed:
    0   libsystem_kernel.dylib          0x000000019945b1e0 __pthread_kill + 8
    1   libsystem_pthread.dylib         0x0000000199524f0c pthread_kill + 112
    2   libsystem_c.dylib               0x00000001993ceb78 abort + 140
    3   libc++abi.dylib                 0x00000001981913f4 __cxa_bad_cast + 0
    4   libc++abi.dylib                 0x00000001981aaf60 std::__terminate(void (*)()) + 44
    5   libc++abi.dylib                 0x00000001981aab10 __cxa_rethrow + 144
    6   libobjc.A.dylib                 0x0000000198b14120 objc_exception_rethrow + 44
    7   CoreFoundation                  0x0000000183e04e68 CFRunLoopRunSpecific + 552
    8   WebCore                         0x0000000195a69aa0 RunWebThread(void*) + 456
    9   libsystem_pthread.dylib         0x0000000199523b3c _pthread_body + 156
    10  libsystem_pthread.dylib         0x0000000199523aa0 _pthread_body + 0
    11  libsystem_pthread.dylib         0x0000000199521030 thread_start + 4
    

, WebThread, , , .

, ios8. *. - , ? - iOS8? Apple.

.

+4
2

, .

, . -. - ( , ), 800 -1 , .

, WebThread , ( , ), -.

+1

. , , - . :

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
    return NO;
}
return YES;

}

+1

Source: https://habr.com/ru/post/1608963/


All Articles