iOS custom keyboard throws exception

212 Views Asked by At

Developing an iOS app using Rubymotion and the task at hand is to make the keyboard smaller. The stock keyboard for some reason is the larger version (pre-iOS7?) as opposed to the newer stock keyboard which is roughly a half-inch shorter. Found a few examples adding "com.apple.keyboard-service" to info.plist and subclassing UIInputViewController for the custom keyboard. Example:

Custom Keyboard template

Seems like it could be something to do with the NSExtension added to the plist. In the test project, ProMotion is the only gem being used. In both the main project and even a fresh, empty project, I get the same error as found below:

    15:01 $ rake
     Build ./build/iPhoneSimulator-9.1-Development
    Create ./build/iPhoneSimulator-9.1-Development/Keyboard.app/Info.plist
  Simulate ./build/iPhoneSimulator-9.1-Development/Keyboard.app
*** Starting simulator
Type `pm_live` to enable ProMotion's live reload system.
*** You will not be able to be use the REPL until the application is activated again.
2015-11-30 15:01:38.319 Keyboard[43165:10103898] *** Assertion failure in +[UIScreen _FBSDisplayDidPossiblyConnect:withScene:andPost:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIScreen.m:590
2015-11-30 15:01:38.324 Keyboard[43165:10103898] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Told about <FBSDisplay: 0x10b073260; name: Main ("LCD"); scale: 2.0; displayID: 1> {
    bounds = {{0, 0}, {375, 667}};
    seed = 1;
    tags = 0;
    pid = 0;
    hidden = NO;
}, but this UIScreen: <UIScreen: 0x10b238d50; bounds = {{0, 0}, {375, 667}}; mode = <UIScreenMode: 0x10b235eb0; size = 750.000000 x 1334.000000>> already has this display: <FBSDisplay: 0x10b235020; name: Main ("LCD"); scale: 2.0; displayID: 1> {
    bounds = {{0, 0}, {375, 667}};
    seed = 5;
    tags = 0;
    pid = 0;
    hidden = NO;
}'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000102f98f45 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001003f1deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000102f98daa +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00000001020dd5ee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   UIKit                               0x0000000100e581c3 +[UIScreen _FBSDisplayDidPossiblyConnect:withScene:andPost:] + 714
    5   UIKit                               0x0000000100b14feb -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 481
    6   FrontBoardServices                  0x000000010499ae70 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 265
    7   FrontBoardServices                  0x00000001049b3784 -[FBSSerialQueue _performNext] + 192
    8   FrontBoardServices                  0x00000001049b3af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    9   CoreFoundation                      0x0000000102ec5011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    10  CoreFoundation                      0x0000000102ebaf3c __CFRunLoopDoSources0 + 556
    11  CoreFoundation                      0x0000000102eba3f3 __CFRunLoopRun + 867
    12  CoreFoundation                      0x0000000102eb9e08 CFRunLoopRunSpecific + 488
    13  GraphicsServices                    0x0000000104da5ad2 GSEventRunModal + 161
    14  UIKit                               0x0000000100b1930d UIApplicationMain + 171
    15  Keyboard                            0x000000010000d57f main + 111
    16  libdyld.dylib                       0x00000001044c592d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
1

There are 1 best solutions below

0
On

We ran into this problem recently as well. It actually has to do with the resolution that you load your app in. Because of the IPhone 5. The application will load an image on startup to set your default resolution for the application. [email protected] in resources folder is a black image that is being used.

google book that has info about app structure and this file