react-native使用映像组件崩溃,除了NSRangeException

时间:2016-01-06 11:40:47

标签: image react-native



public void paintComponent(Graphics g) {
    super.paintComponent(g); 




我写了一个ListView组件,每行包含一个图像,Image使用uri来获取源代码,但是当我获取错误的图像源时,整个应用程序崩溃了!这很奇怪,因为我使用了#abcdeee'替换item.image.it仍然工作,没有崩溃。 我的代码是



2016-01-06 20:07:21.905 AwsomeProject_17[871:54535] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 187 out of bounds; string length 186'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010936ee65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x0000000108572deb objc_exception_throw + 48
	2   CoreFoundation                      0x000000010936ed9d +[NSException raise:format:] + 205
	3   Foundation                          0x000000010811a11d -[NSString substringFromIndex:] + 126
	4   AwsomeProject_17                    0x0000000107ea4205 RCTBundlePathForURL + 293
	5   AwsomeProject_17                    0x0000000107ea428d RCTIsXCAssetURL + 45
	6   AwsomeProject_17                    0x0000000107ef62e0 -[RCTXCAssetImageLoader canLoadImageURL:] + 48
	7   AwsomeProject_17                    0x0000000107eed887 -[RCTImageLoader imageURLLoaderForURL:] + 615
	8   AwsomeProject_17                    0x0000000107eeec80 __87-[RCTImageLoader loadImageWithTag:size:scale:resizeMode:progressBlock:completionBlock:]_block_invoke_2125 + 368
	9   libdispatch.dylib                   0x000000010c8f1e5d _dispatch_call_block_and_release + 12
	10  libdispatch.dylib                   0x000000010c91249b _dispatch_client_callout + 8
	11  libdispatch.dylib                   0x000000010c8f88ec _dispatch_queue_drain + 2215
	12  libdispatch.dylib                   0x000000010c8f7e0d _dispatch_queue_invoke + 601
	13  libdispatch.dylib                   0x000000010c8faa56 _dispatch_root_queue_drain + 1420
	14  libdispatch.dylib                   0x000000010c8fa4c5 _dispatch_worker_thread3 + 111
	15  libsystem_pthread.dylib             0x000000010cc4a68f _pthread_wqthread + 1129
	16  libsystem_pthread.dylib             0x000000010cc48365 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 




0 个答案:

没有答案