小编Hug*_*ugo的帖子

React Native Expo无法构建JavaScript包

安装包并运行react-native链接后.当我尝试在Xcode上启动模拟器时,我在exp start的日志中收到以下错误消息:

构建JavaScript包失败.

有0个额外的信息,我的项目运行,但这个错误出现在终端,让模拟器停留在0%...

我不知道如何解决这个问题,因为我无法获得任何其他错误或信息,只有这个******错误消息.

react-native expo

8
推荐指数
1
解决办法
5031
查看次数

博览会构建:ios 抛出原因:未知原因,原始:“SSL_connect 返回 = 1 errno = 0 状态 = 错误:证书验证失败”

昨天我设法成功运行命令 expo build:ios 但今天早上它不起作用,我在输入凭据后收到以下错误消息:

Trying to authenticate with Apple Developer Portal...
Authentication with Apple Developer Portal failed!
Reason: Unknown reason, raw: "SSL_connect returned=1 errno=0 state=error: certificate 
verify failed"
Set EXPO_DEBUG=true in your env to view the stack trace.
Run Code Online (Sandbox Code Playgroud)

知道错误来自哪里吗?我已经检查了苹果服务状态,一切正常。

这是我的设置

Expo CLI 3.11.5 environment info:
System:
  OS: macOS 10.14.5
  Shell: 5.3 - /bin/zsh
Binaries:
  Node: 10.16.3 - /usr/local/bin/node
  Yarn: 1.19.1 - /usr/local/bin/yarn
  npm: 6.9.0 - /usr/local/bin/npm
  Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
  Android Studio: 3.4 AI-183.6156.11.34.5692245
  Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages: …
Run Code Online (Sandbox Code Playgroud)

ios react-native expo

8
推荐指数
2
解决办法
3063
查看次数

解决 React Native 中“source.uri 不应为空字符串”的问题

我无法解决

source.uri 不应为空字符串

在 React Native 中。

我不明白这个错误来自哪里。我的组件中有 3 个Flatlist,它使用来自父级的道具作为 URI呈现组件,并且这些都不是空的。

这是uri部分:

<Image style={styles.imageStyle} source={{uri: this.props.url }} />
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

javascript react-native

7
推荐指数
3
解决办法
1万
查看次数

内存如何在Ruby中运行?

我试图理解Ruby中内存使用背后的想法.我目前正在浏览我的Rails Web应用程序和API上的内存问题.

这是一个简单的问题:

如果我在变量中加载许多记录,如下所示:

users = User.where(work: 'cook')
Run Code Online (Sandbox Code Playgroud)

这可能会在我使用此变量的时候保存在我的应用程序内存中,对吧?

但是在我在代码中使用变量后,通过执行以下操作来释放内存是否有帮助?

users = nil
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助.我也乐于回答有关更广泛主题的问题.

ruby memory ruby-on-rails

7
推荐指数
1
解决办法
112
查看次数

反应本机fbsdk问题 - 任务:react-native-fbsdk:compileDebugJavaWithJavac FAILED

在安装fbsdk库并按照所有步骤正确链接后,我在使用react-native run-android构建我的android文件夹时出现问题.以下是我的错误消息.

我已经尝试将我的默认sdk版本从23更改为27.0.1,这让我有更详细的错误消息,因为之前我只能构建aapp失败.

知道如何解决这个问题吗?它适用于ios.

> Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED
/Users/hugohyz/code/hugoh1995/dogtime_react/DogtimeReactInit/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBAppEventsLoggerModule.java:209: error: cannot find symbol
     @ReactMethod(isBlockingSynchronousMethod = true)
                                                ^
  symbol:   method isBlockingSynchronousMethod()
  location: @interface ReactMethod
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/hugohyz/code/hugoh1995/dogtime_react/DogtimeReactInit/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/Utility.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-fbsdk:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* …
Run Code Online (Sandbox Code Playgroud)

android android-studio reactjs react-native fbsdk

6
推荐指数
1
解决办法
4813
查看次数

React Apollo GraphQL :需要解析的 GraphQL 文档。也许您需要将查询字符串包装在“gql”标签中?

在突变后尝试更新缓存时,我不断收到此错误:

可能未处理的 Promise 拒绝 (id: 0): Invariant Violation: Expecting an parsed GraphQL document。也许您需要将查询字符串包装在“gql”标签中?

突变成功,然后我在onCompleted方法中运行此代码。

const cards = this.props.client.readQuery({ FETCH_CARDS, variables: { userId: data.createPaymentMethod.userId } });

const { id,
        brand,
        lastFour,
        userId,
        stripeID } = data.createPaymentMethod

const paymentMethod = {
  id: id,
  brand: brand,
  lastFour: lastFour,
  userId: userId,
  stripeID: stripeID,
  __typename: 'PaymentMethod',
};

// Write back to the to-do list and include the new item
this.props.client.writeQuery({
  FETCH_CARDS,
  data: {
    paymentMethod: [...cards.paymentMethod, paymentMethod],
  },
});
Run Code Online (Sandbox Code Playgroud)

我不明白我做错了什么。我正在遵循本指南:https : //www.apollographql.com/docs/react/caching/cache-interaction/#writequery-and-writefragment

编辑:FETCH_CARDS …

apollo reactjs graphql

6
推荐指数
2
解决办法
6625
查看次数

Graphql 突变错误:“字段‘createUser’缺少必需参数:输入”

我正在尝试按照本文介绍如何使用 GraphQl https://www.howtographql.com/graphql-ruby/4-authentication在 Rails 服务器上创建突变

但是,我被困在 CreateUser Mutation 步骤中,在 GraphiQL 中尝试时出现以下错误哈希:

{
  "errors": [
    {
      "message": "Field 'createUser' is missing required arguments: input",
      "locations": [
        {
          "line": 45,
          "column": 3
        }
      ],
      "path": [
        "mutation CreateUser",
        "createUser"
      ],
      "extensions": {
        "code": "missingRequiredArguments",
        "className": "Field",
        "name": "createUser",
        "arguments": "input"
      }
    },
    {
      "message": "Field 'createUser' doesn't accept argument 'username'",
      "locations": [
        {
          "line": 46,
          "column": 5
        }
      ],
      "path": [
        "mutation CreateUser",
        "createUser",
        "username"
      ],
      "extensions": {
        "code": "argumentNotAccepted",
        "name": …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails graphql graphiql

6
推荐指数
2
解决办法
1803
查看次数

此声明是实验性的,其用法必须用“@kotlin.ExperimentalStdlibApi”或“@OptIn(kotlin.ExperimentalStdlibApi::class)”标记

升级到 React Native 0.70.6 后,我在 android 上不断遇到这个问题,好几天都没有找到解决方案。

> Task :react-native-gradle-plugin:compileKotlin FAILED
e: /Users/hugohouyez/code/hugoh1995/Superprof/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt: (137, 11): This declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
Run Code Online (Sandbox Code Playgroud)

我已经在我的 package.json 中安装了 "react-native-gradle-plugin": "^0.71.10",尽管文档中没有提到它,因为如果没有它,它会说找不到依赖项。

构建.gradle

...
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.0")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        classpath("com.google.gms:google-services:4.3.10")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
Run Code Online (Sandbox Code Playgroud)

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin react-native

6
推荐指数
1
解决办法
3631
查看次数

使用expo SDK的react native ios app的Info.plist文件

我正在寻找正确格式化Info.plist文件,以便使用react-native-in-app-utils进行应用程序购买工作,但我不确定如何格式化数据以及要插入哪种数据.

该主题提到必须在Info.plist文件中包含应用程序包ID.

iOS应用内购买 - 未收到任何产品

in-app-purchase ios reactjs react-native react-native-in-app-utils

5
推荐指数
1
解决办法
6928
查看次数

我们如何只为 React Native Android 上的特定视图指定“windowSoftInputMode”?

我们如何才能为基于 React Native 构建的 Android 应用程序的特定视图指定“ windowSoftInputMode ”?

我遇到了这个需要使用的问题

android:windowSoftInputMode="adjustNothing"
Run Code Online (Sandbox Code Playgroud)

对于我的大部分应用程序,然后我需要对特定库react-native-gifted-chat使用相反的内容。

是否可以设置windowSoftInputMode的值,然后在特定视图上覆盖它?

android android-manifest react-native

5
推荐指数
0
解决办法
306
查看次数

fetch 返回语法错误:JSON 中位置 0 处出现意外标记 T

我正在尝试使用 Javascript 获取方法,但是,它似乎不能异步工作。

这是我的代码:

fetch(`${global.URL}${url}`, requestConfig)
  .then(res => res.json())
  .then(res => {
    console.log('response', res);
    return res;
  })
  .catch(error => {
    console.log('error: ', error)
  })
Run Code Online (Sandbox Code Playgroud)

我在 70% 的情况下收到以下错误,然后在另外 30% 的情况下收到有效响应,当我保存文件并重新渲染时,它有时会起作用。

error:  SyntaxError: Unexpected token T in JSON at position 0
    at parse (<anonymous>)
    at tryCallOne (core.js:37)
    at core.js:123
    at JSTimers.js:277
    at _callTimer (JSTimers.js:135)
    at _callImmediatesPass (JSTimers.js:183)
    at Object.callImmediates (JSTimers.js:446)
    at MessageQueue.__callImmediates (MessageQueue.js:396)
    at MessageQueue.js:144
    at MessageQueue.__guard (MessageQueue.js:373)
Run Code Online (Sandbox Code Playgroud)

我尝试在 async/await 函数内部调用它,但没有帮助。

编辑1:

这就是我提出要求的方式

const authenticityToken = global.TOKEN

const query = (url, config) …
Run Code Online (Sandbox Code Playgroud)

javascript fetch reactjs react-native fetch-api

5
推荐指数
2
解决办法
2万
查看次数

如何在反应本机推送通知中重置应用程序徽章编号?

当用户打开应用程序时,我正在寻找react-native-push-notification中的重置应用程序徽章编号,但在文档中的任何位置都找不到该方法,知道吗?

push-notification react-native react-native-push-notification

4
推荐指数
2
解决办法
1万
查看次数

如何将 React Native 应用程序上的本地图像文件上传到 Rails api?

例如,我无法理解如何使用 Rails api 将来自智能手机的本地文件路径上传到服务器端。

我们发送到后端的文件路径对服务器没有任何意义?

我从这样的响应中得到一个 uri:

file:///Users/.../Documents/images/5249F841-388B-478D-A0CB-2E1BF5511DA5.jpg):

我试图将这样的东西发送到服务器:

  let apiUrl = 'https://vnjldf.ngrok.io/api/update_photo'

  let uriParts = uri.split('.');
  let fileType = uri[uri.length - 1];

  let formData = new FormData();
  formData.append('photo', {
    uri,
    name: `photo.${fileType}`,
    type: `image/${fileType}`,
  });

  let options = {
    method: 'POST',
    body: formData,
    headers: {
      Accept: 'application/json',
      'Content-Type': 'multipart/form-data',
    },
  };
Run Code Online (Sandbox Code Playgroud)

但我不确定它是什么以及如何在后端对其进行解密。

我也尝试发送 uri direclty 但当然我收到以下错误:

Errno::ENOENT (No such file or directory @ rb_sysopen -...
Run Code Online (Sandbox Code Playgroud)

任何帮助/指导将不胜感激。

file-upload ruby-on-rails image-uploading cloudinary react-native

1
推荐指数
1
解决办法
1401
查看次数