小编bra*_*dos的帖子

错误:没有为给定视图控制器注册本机启动屏幕。对于使用expo-splash-screen的react-native expo

Unhandled promise rejection: Error: No native splash screen registered for given view controller. Call 'SplashScreen.show' for given view controller first.

当我第一次启动该应用程序时,仅在我的 ios 模拟器上收到以下警告。不在我的 ios 物理设备或 Android 模拟器上。我用于expo-splash-screen我的闪屏。这是我可以忽略的事情还是我需要解决它,因为我不知道如何解决它。启动画面似乎加载良好。这是一个错误吗expo-splash-screen?我按照世博会的教程进行设置。

警告:

[Unhandled promise rejection: Error: No native splash screen registered for given view controller. Call 'SplashScreen.show' for given view controller first.]
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-splash-screen/build/SplashScreen.js:23:17 in hideAsync
at node_modules/expo-splash-screen/build/SplashScreen.js:19:7 in hideAsync
at [native code]:null in callFunctionReturnFlushedQueue
Run Code Online (Sandbox Code Playgroud)

索引.js

import React, { useState, …
Run Code Online (Sandbox Code Playgroud)

react-native expo

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

SWIFT:将 JSON 对象解码为结构

我正在尝试将 json 数据解析为可解码的结构。我很困惑,因为我不知道如何在每个数组没有键的情况下映射对象数组。我的 json 是:

{
    "table": [
        {
            "name": "Liverpool",
            "win": 22,
            "draw": 1,
            "loss": 0,
            "total": 67
        },
        {
            "name": "Man City",
            "win": 16,
            "draw": 3,
            "loss": 5,
            "total": 51
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

这是我当前的结构:

struct Table: Decodable {
    let name: String
    let win: Int
    let draw: Int
    let loss: Int
    let total: Int
}
Run Code Online (Sandbox Code Playgroud)

我只是想做类似的事情:

    let tables = try! JSONDecoder().decode([Table].self, from: jsonData)
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "name", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: …
Run Code Online (Sandbox Code Playgroud)

json struct decode swift

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

标签 统计

decode ×1

expo ×1

json ×1

react-native ×1

struct ×1

swift ×1