iOS自定义键盘抛出异常

时间:2015-11-30 20:18:20

标签: ios rubymotion ios-app-extension custom-keyboard rubymotion-promotion

使用Rubymotion开发iOS应用程序,手头的任务是缩小键盘。股票键盘由于某种原因是较大的版本(iOS7之前?)而不是较新的股票键盘,大约短半英寸。找到一些例子,添加" com.apple.keyboard-service"到info.plist并为自定义键盘子类化UIInputViewController。例如:

Custom Keyboard template

似乎可能与添加到plist的NSExtension有关。在测试项目中,ProMotion是唯一使用的宝石。在主项目甚至是一个新的空项目中,我都得到了与下面相同的错误:

    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 个答案:

答案 0 :(得分:0)

我们最近也遇到了这个问题。它实际上与您加载应用程序的分辨率有关。由于IPhone 5.应用程序将在启动时加载图像以设置应用程序的默认分辨率。资源文件夹中的default-568h@2x.png是正在使用的黑色图像。

google book that has info about app structure and this file