1
我正在使用react-native-piechart來呈現單個圖表。我已將ART.xcodeproj
添加到我的圖書館。我還將libART.a
添加到我的Build Phases > Link Binary With Libraries
。React Native - NSInvalidArgumentException
當我渲染圖表時,我的應用程序崩潰。當運行react-native log-ios
我得到以下堆棧跟蹤
Apr 13 16:37:30 Dan-MBP mycpd[52875] <Error>: -[__NSArrayI length]: unrecognized selector sent to instance 0x6080000e8b80
Apr 13 16:37:30 Dan-MBP mycpd[52875] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI length]: unrecognized selector sent to instance 0x6080000e8b80'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105159d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000103fdd21e objc_exception_throw + 48
2 CoreFoundation 0x00000001051c9f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001050df005 ___forwarding___ + 1013
4 CoreFoundation 0x00000001050deb88 _CF_forwarding_prep_0 + 120
5 mycpd 0x0000000100cd0f77 -[RNSVGPathParser initWithPathString:] + 295
6 mycpd 0x0000000100cce0a0 +[RCTConvert(RNSVG) CGPath:] + 80
7 mycpd 0x0000000100c1ac0a __49-[RCTComponentData propBlockForKey:inDictionary:]_block_invoke.223 + 282
8 mycpd 0x0000000100c1b840 __49-[RCTComponentData propBlockForKey:inDictionary:]_block_invoke.259 + 720
9 mycpd 0x0000000100c1bbb8 __49-[RCTComponentData propBlockForKey:inDictionary:]_block_invoke_2.272 + 40
10 mycpd 0x0000000100bb6dd3 RCTPerformBlockWithLogFunction + 483
11 mycpd 0x0000000100bb6f8f RCTPerformBlockWithLogPrefix + 239
12 mycpd 0x0000000100c1bb1d __49-[RCTComponentData propBlockForKey:inDictionary:]_block_invoke.267 + 445
13 mycpd 0x0000000100c1c015 __37-[RCTComponentData setProps:forView:]_block_invoke + 181
14 CoreFoundation 0x00000001050ea2a5 __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
15 CoreFoundation 0x00000001050ea1ba -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 250
16 mycpd 0x0000000100c1be7f -[RCTComponentData setProps:forView:] + 223
17 mycpd 0x0000000100c01f02 __50-[RCTUIManager createView:viewName:rootTag:props:]_block_invoke + 162
18 libdispatch.dylib 0x0000000107804808 _dispatch_call_block_and_release + 12
19 libdispatch.dylib 0x000000010782612e _dispatch_client_callout + 8
20 libdispatch.dylib 0x000000010780d4fb _dispatch_main_queue_callback_4CF + 1054
21 CoreFoundation 0x000000010511de49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
22 CoreFoundation 0x00000001050e337d __CFRunLoopRun + 2205
23 CoreFoundation 0x00000001050e2884 CFRunLoopRunSpecific + 420
24 GraphicsServices 0x0000000109cd2a6f GSEventRunModal + 161
25 UIKit 0x0000000102161c68 UIApplicationMain + 159
26 mycpd 0x0000000100a08ddf main + 111
27 libdyld.dylib 0x000000010786f68d start + 1
28 ??? 0x0000000000000001 0x0 + 1
)
Apr 13 16:37:30 Dan-MBP SpringBoard[50607] <Error>: [KeyboardArbiter] HW kbd: Failed to set (null) as keyboard focus
Apr 13 16:37:30 Dan-MBP com.apple.CoreSimulator.SimDevice.D55EDF21-DD38-4727-9408-2ED7C7D3E93F.launchd_sim[50590] (UIKitApplication:com.thinkdigital.mycpd[0xb38b][52875]) <Notice>: Service exited due to Abort trap: 6
Apr 13 16:37:30 Dan-MBP backboardd[50608] <Error>: [Common] Unable to get short BSD proc info for 52875: No such process
Apr 13 16:37:30 Dan-MBP backboardd[50608] <Error>: [Common] Unable to get proc info for 52875: No such process
Apr 13 16:37:30 Dan-MBP assertiond[50611] <Warning>: notify_suspend_pid() failed with error 7
我已經試過
- 經紗取出包,並從Xcode中移除
ART.xcodeproj
和libART.a
,然後重新安裝。 - 我試過了多個圖表庫 - 這個問題依然存在。
- 我創建了一個全新的項目來測試庫不會引起問題,他們工作得很好。
你應該該報告爲圖書館的發展。 'NSArray'類沒有'length'方法,但只有[count](https://developer.apple.com/reference/foundation/nsarray/1409982-count?language=objc)方法。這是一個bug或者在本地ObjC的'NSArray'類之上實現的一些奇怪的擴展。 –
我不相信這是圖書館@StanislavPankevich的問題,它已經工作了3-4周,並且在單獨的React Native項目中工作。我想也許這是我不小心點擊Xcode的東西。 – Dan
我唯一指出的是數組而不是字符串被傳遞給'RNSVGPathParser'的初始值設定項。它試圖計算一個字符串的長度,但是碰到了數組,因此崩潰了。我是Objective-C開發人員,不熟悉ReactNative,所以我不能說爲什麼圖書館走錯了路。 –