使用NSException类型的未捕获异常来响应本机终止

时间:2016-01-04 21:57:57

标签: ios xcode react-native

我将ReactNative升级到0.17后运行应用程序时出错 我用0.13

工作得很好

错误代码是

    2016-01-04 12:22:37.405 myapp [16916:350051] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 175 out of bounds; string length 174'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ea9ce65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010dca0deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010ea9cd9d +[NSException raise:format:] + 205
    3   Foundation                          0x000000010d84811d -[NSString substringFromIndex:] + 126
    4   myapp                            0x000000010d5e15f5 RCTBundlePathForURL + 293
    5   myapp                            0x000000010d5e167d RCTIsXCAssetURL + 45
    6   myapp                            0x000000010d6336d0 -[RCTXCAssetImageLoader canLoadImageURL:] + 48
    7   myapp                            0x000000010d62ac77 -[RCTImageLoader imageURLLoaderForURL:] + 615
    8   myapp                            0x000000010d62c070 __87-[RCTImageLoader loadImageWithTag:size:scale:resizeMode:progressBlock:completionBlock:]_block_invoke_2125 + 368
    9   libdispatch.dylib                   0x000000011201fe5d _dispatch_call_block_and_release + 12
    10  libdispatch.dylib                   0x000000011204049b _dispatch_client_callout + 8
    11  libdispatch.dylib                   0x00000001120268ec _dispatch_queue_drain + 2215
    12  libdispatch.dylib                   0x0000000112025e0d _dispatch_queue_invoke + 601
    13  libdispatch.dylib                   0x0000000112028a56 _dispatch_root_queue_drain + 1420
    14  libdispatch.dylib                   0x00000001120284c5 _dispatch_worker_thread3 + 111
    15  libsystem_pthread.dylib             0x000000011237868f _pthread_wqthread + 1129
    16  libsystem_pthread.dylib             0x0000000112376365 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

原始代码在这里 https://gist.github.com/AhmedMAtia/141208f80e28a4343e26

1 个答案:

答案 0 :(得分:0)

我也很难从0.13升级。我通过创建一个新项目,然后移动我的自定义应用程序代码来解决这个问题。