菜鸟教程小白 发表于 2022-12-11 18:47:53

ios - 在iOS11上添加文本字段或点击textview崩溃


                                            <p>我的项目在xcode 8中运行良好。但是在Xcode 9中,它在发布时崩溃了。将文本字段添加到情节提要或轻敲文本视图会导致崩溃。如果没有文本字段,则不会崩溃。我尝试更新pods并检查64位兼容性,删除旧字体文件,重新创建项目。这个项目有本地化。这可能是问题所在吗?<br><pre><code>    Terminating app due to uncaught exception &#39;NSRangeException&#39;, reason: &#39;*** -: Index 9223372036854775807 out of bounds; string length 8&#39;
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010a9b11cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010a30ff41 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010aa25b95 + + 197
    3   Foundation                        0x0000000109d02df7 - + 118
    4   UIKit                               0x000000010bfcfd6c _normalizedAnimationKey + 97
    5   UIKit                               0x000000010bfcf718 - + 128
    6   UIKit                               0x000000010bfd049d - + 193
    7   UIKit                               0x000000010bffb6bb + + 114
    8   UIKit                               0x000000010c939a22 - + 157
    9   QuartzCore                        0x000000010bd788c4 - + 104
    10QuartzCore                        0x000000010bd7ea49 _ZN2CA5Layer12begin_changeEPNS_11TransactionEjP11objc_objectRS4_ + 169
    11QuartzCore                        0x000000010bd86241 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 253
    12QuartzCore                        0x000000010bd76c96 - + 43
    13UIKit                               0x000000010bfe83b3 - + 233
    14UIKit                               0x000000010bff0f7c - + 1103
    15UIKit                               0x000000010bff106c - + 125
    16CoreFoundation                      0x000000010a93e297 - + 487
    17UIKit                               0x000000010bfefaf9 - + 165
    18UIKit                               0x000000010ca9a98d - + 211
    19UIKit                               0x000000010bff8d99 - + 989
    20UIKit                               0x000000010c00d551 - + 1331
    21QuartzCore                        0x000000010bd7d4ba - + 153
    22QuartzCore                        0x000000010bd815a9 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
    23UIKit                               0x000000010bff7e5f - + 662
    24UIKit                               0x000000010cb6fe4f - + 104
    25UIKit                               0x000000010cb792d9 - + 137
    26UIKit                               0x000000010cb784ad __77-_block_invoke.1000 + 197
    27UIKit                               0x000000010c0009ec + + 560
    28UIKit                               0x000000010c000e3f + + 116
    29UIKit                               0x000000010cb77f81 - + 1558
    30UIKit                               0x000000010cb8027f - + 1147
    31UIKit                               0x000000010cb775c2 - + 50
    32UIKit                               0x000000010c720aa2 - + 1081
    33UIKit                               0x000000010c16a781 - + 81
    34UIKit                               0x000000010cbf35f0 - + 735
    35UIKit                               0x000000010c53cb2b - + 208
    36UIKit                               0x000000010c50dde9 - + 3845
    37UIKit                               0x000000010c52cb8b - + 57
    38UIKit                               0x000000010c535a13 _UIGestureRecognizerSendTargetActions + 109
    39UIKit                               0x000000010c5332be _UIGestureRecognizerSendActions + 307
    40UIKit                               0x000000010c53252a - + 1002
    41UIKit                               0x000000010c51788d _UIGestureEnvironmentUpdate + 1306
    42UIKit                               0x000000010c517327 - + 484
    43UIKit                               0x000000010c5163d3 - + 288
    44UIKit                               0x000000010bfb645c - + 4102
    45UIKit                               0x000000010bf5b802 - + 352
    46UIKit                               0x000000010c88da50 __dispatchPreprocessedEventFromEventQueue + 2809
    47UIKit                               0x000000010c8905b7 __handleEventQueueInternal + 5957
    48CoreFoundation                      0x000000010a9542b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    49CoreFoundation                      0x000000010a9f3d31 __CFRunLoopDoSource0 + 81
    50CoreFoundation                      0x000000010a938c19 __CFRunLoopDoSources0 + 185
    51CoreFoundation                      0x000000010a9381ff __CFRunLoopRun + 1279
    52CoreFoundation                      0x000000010a937a89 CFRunLoopRunSpecific + 409
    53GraphicsServices                  0x0000000110e169c6 GSEventRunModal + 62
    54UIKit                               0x000000010bf3ed30 UIApplicationMain + 159
    55iSpect                              0x00000001078e864f main + 111
    56libdyld.dylib                     0x000000010e5d3d81 start + 1
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p>首先添加异常断点,这样您可以找到确切的崩溃位置,如果不解决请共享代码。<br><a href="/image/yBwXg.png" rel="noreferrer noopener nofollow"><img src="/image/yBwXg.png" alt=""/></a><br><a href="/image/s8Wk0.png" rel="noreferrer noopener nofollow"><img src="/image/s8Wk0.png" alt=""/></a></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在iOS11上添加文本字段或点击textview崩溃,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/46441914/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/46441914/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在iOS11上添加文本字段或点击textview崩溃