本文介绍了aws-sdk(v 2.395.0)和react-native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正忙于升级已继承职责的React Native应用程序,并且在升级react native之后遇到一些构建问题。



决定核销旧项目(基于RN 0.53.3),并使用RN 0.58.2创建新项目。深入了解源代码之后,我在模拟器上的构建被捆绑在Metro捆绑器中的速度约为99%,该应用程序最终超时,告诉我它无法连接至开发服务器。



无法有效地调试问题,我一直在逐个文件,逐个代码地进行依赖,以缩小问题的范围,而第一个导致此问题挂起的问题实际上是 aws-sdk npm模块。



简单地从'aws-sdk / dist添加 import AWS / aws-sdk-react-native'语句,该示例演示了概述的行为。

 无法加载捆绑包(http:// localhost:8081 / index.bundle?platform = ios& dev = true& minify = false),错误:(无法连接到开发服务器。

确保以下各项:
-节点服务器正在运行并且在同一网络上可用-从react-运行'npm start'-本机根
-在AppDelegate中正确设置了节点服务器URL
-启用了WiFi,并将其与节点服务器

连接到同一网络URL:http:// localhost:8081 /index.bundle?platform=ios&dev=true&minify=false无法完成操作。(NSURLErrorDomain错误-999。))

__38- [RCTCxxBridge loadSource:onProgress:] _ block_invoke .226
RCTCxxBridge.mm:412
___ ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
-[RCTcom-Stream:D:B:$ _ B $ b_b_b $ b_b_b_b_b $ b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b_b $ b_b_b_b_b_b_b_b_b_b $ b_b_b_b_b_b $ b_b_b $ b_b_b $ b_b_b $ b_b $ b_b $ b_b $ b_b $ b委托的
-b
委托-bcbstreambdeb-streamc ecomeInputStream:outputStream:completionHandler:] _ block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__ NSOperationInternal _start:]
__NSOQSchedule_f
_call _call_dis__atch_dis_call b _dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread2
_pthread_wqthread
start_wqthread
RN环境信息如下:

  React Native环境信息:
系统:
OS:macOS 10.14
CPU:(8)x64 Intel(R)Core(TM)i7-7820HQ CPU @ 2.90GHz
内存:1.04 GB / 16.00 GB
Shell:5.3- / bin / zsh
二进制文件:
节点:8.12.0-/ usr / local / bin / node
npm:6.4.1-/ usr / local / bin / npm
Watchman:4.9.0-/ usr / local / bin / watchman
SDK:
iOS SDK:
平台:iOS 12.1,macOS 10.14,tvOS 12.1,watchOS 5.1
Android SDK:
API级别:10、11、12、13、14、15、16、17、18、19、20、21、22、23、24 ,25、26、27、28、7、8、9
构建工具:19.1.0、21.1.2、22.0.1、23.0.1、23.0.2、25.0.2、26.0.3、27.0 .3,28.0.2
系统图片:android-22 | Google API Intel x86 Atom,android-25 | Google API Intel x86 Atom,android-26 | Google API Intel x86 Atom_64,android-28 | Google API Intel x86 Atom
IDEs:
Android Studio:3.2 AI-181.5540.7.32.5056338
Xcode:10.1 / 10B61-/ usr / bin / xcodebuild
npm包装:
反应:16.6.3 => 16.6.3
react-native:0.58.3 => 0.58.3
npmGlobalPackages:
react-native-cli:2.0.1
react-native-git-upgrade:0.2.7
react-native-patch:0.2.0


解决方案

请查找附件。.经过2天的努力




Am in the throes of upgrading a react native application that I've inherited responsibilities for, and am coming across some build issues after upgrading react native.

I have decided to nuke the old project (based on RN 0.53.3) and created a new project with RN 0.58.2. After shoe horning the source in, my builds to simulator were getting hung up in the metro bundler at ~99%, with the application eventually timing out telling me that it Could not connect to development server.

Unable to effectively debug the issue, I have been going file by file, code dependency by dependency to narrow down the issue, and the first issue that is causing this hang up is actually the aws-sdk npm module.

After simply adding the import AWS from 'aws-sdk/dist/aws-sdk-react-native' statement, build demonstrates the outlined behavior.

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Could not connect to development server.

Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
- WiFi is enabled and connected to the same network as the Node Server

URL: http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false The operation couldn’t be completed. (NSURLErrorDomain error -999.))

__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.226
    RCTCxxBridge.mm:412
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
__NSOQSchedule_f
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread2
_pthread_wqthread
start_wqthread

RN Environment information is as follows:

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 1.04 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.12.0 - /usr/local/bin/node
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 7, 8, 9
        Build Tools: 19.1.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 25.0.2, 26.0.3, 27.0.3, 28.0.2
        System Images: android-22 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.58.3 => 0.58.3
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-patch: 0.2.0
解决方案

Please find the attachment.. After struggling of 2 days we got a solution by Max-old-size in xcode.

这篇关于aws-sdk(v 2.395.0)和react-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 09:40