React Native - NSInvalidArgumentException

时间:2017-04-13 15:44:40

标签: ios xcode reactjs react-native

我使用react-native-piechart渲染单个图表。我已将ART.xcodeproj添加到我的库中。我还在libART.a添加了Build Phases > Link Binary With Libraries

当我渲染图表时,我的应用程序崩溃了。运行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.xcodeprojlibART.a,然后重新安装。
  • 我尝试了多个图表库 - 这个问题仍然存在。
  • 我创建了一个新项目来测试库没有引起问题,他们工作得很好。

1 个答案:

答案 0 :(得分:2)

使用react-native-progress时遇到了同样的问题。报告了类似的崩溃here

要修复我删除了对react-native-svg的引用,然后运行:

npm install react-native-svg --save

react-native link react-native-svg