使用“react-native run-ios”完美地工作,但是使用XCode抛出“找不到变量:self”

时间:2016-11-30 06:38:49

标签: react-native

我为我的应用程序编写了react-native app。当我使用react-native run-ios运行时,它的工作完全正常。现在我需要创建iOS构建,因此我使用XCode来首先运行它。但是,我得到了Can't find variable: self fetch-npm-browserify.js:6。我不知道为什么使用XCode运行失败但没有使用react-native run-ios

以下是XCode中的错误以供参考。

2016-11-29 23:57:34.828 [error][tid:com.facebook.react.JavaScript] Can't find variable: self
2016-11-29 23:57:34.831 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Can't find variable: self
2016-11-29 23:57:34.832 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2016-11-29 23:57:34.840 AmexPay[44068:133851] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Can't find variable: self', reason: 'Unhandled JS Exception: Can't find variable: self, stack:
<unknown>@797:44
n@2:545
<unknown>@796:2649
n@2:545
<unknown>@470:249
n@2:545
<unknown>@469:123
n@2:545
<unknown>@377:1118
n@2:545
<unknown>@376:170
n@2:545
<unknown>@374:141
n@2:545
<unknown>@367:327
n@2:545
<unknown>@366:170
n@2:545
<unknown>@365:100
n@2:545
<unknown>@12:99
n@2:545
i@2:266
global code@1390:9
'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108f3134b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000107e3f21e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000108f9a265 +[NSException raise:format:] + 197
    3   AmexPay                             0x00000001075ca91c RCTFatal + 393
    4   AmexPay                             0x00000001075c365e -[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 515
    5   CoreFoundation                      0x0000000108eb805c __invoking___ + 140
    6   CoreFoundation                      0x0000000108eb7ee1 -[NSInvocation invoke] + 289
    7   CoreFoundation                      0x0000000108ecfed6 -[NSInvocation invokeWithTarget:] + 54
    8   AmexPay                             0x00000001075c7288 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 585
    9   AmexPay                             0x00000001075eec7a -[RCTBatchedBridge callNativeModule:method:params:] + 220
    10  AmexPay                             0x00000001075ee4d6 __33-[RCTBatchedBridge handleBuffer:]_block_invoke.357 + 503
    11  libdispatch.dylib                   0x000000010ce0e810 _dispatch_call_block_and_release + 12
    12  libdispatch.dylib                   0x000000010ce3012e _dispatch_client_callout + 8
    13  libdispatch.dylib                   0x000000010ce15523 _dispatch_queue_serial_drain + 1018
    14  libdispatch.dylib                   0x000000010ce15cf3 _dispatch_queue_invoke + 1118
    15  libdispatch.dylib                   0x000000010ce1609b _dispatch_queue_override_invoke + 376
    16  libdispatch.dylib                   0x000000010ce17a0e _dispatch_root_queue_drain + 506
    17  libdispatch.dylib                   0x000000010ce177b4 _dispatch_worker_thread3 + 113
    18  libsystem_pthread.dylib             0x000000010d1d64de _pthread_wqthread + 1129
    19  libsystem_pthread.dylib             0x000000010d1d4341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

0 个答案:

没有答案