首页 > 解决方案 > aws-sdk (v 2.395.0) 和 react-native

问题描述

我正在升级我继承职责的 react native 应用程序的阵痛,并且在升级 react native 后遇到了一些构建问题。

我决定取消旧项目(基于 RN 0.53.3)并使用 RN 0.58.2 创建一个新项目。在插入源代码后,我对模拟器的构建以大约 99% 的速度挂在 Metro 捆绑器中,应用程序最终超时,告诉我它无法连接到开发服务器。

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

在简单地添加import AWS from 'aws-sdk/dist/aws-sdk-react-native'语句之后,构建演示了概述的行为。

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环境信息如下:

  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

标签: react-nativeaws-sdkaws-sdk-js

解决方案


请找到附件。经过 2 天的努力,我们在 xcode 中得到了 Max-old-size 的解决方案。

请查收附件


推荐阅读