小编Vic*_*lyk的帖子

启动终端 Macos 时出现错误 ATCRTRestoreInfoFTABSubfile 类在两者中均已实现

首次启动终端时总是出现此错误。

objc[9318]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x207c11eb0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103d984f8). One of the two will be used. Which one is undefined.
objc[9318]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x207c11f00) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103d98548). One of the two will be used. Which one is undefined.
objc[9318]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x207c11f50) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103d98598). One of the two will be used. Which one is undefined.
objc[9318]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x207c11fa0) and …
Run Code Online (Sandbox Code Playgroud)

macos xcode iterm apple-m1

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

找不到类“...”的序列化程序。将类标记为 @Serializable 或显式提供序列化器

您好,我在 kotlin 中类序列化时遇到问题

构建.gradl.kt

...
plugins {
    application
    kotlin("jvm") version "1.6.21"
    kotlin("plugin.serialization").version("1.6.21")
}
...
depenedancies{
...
    implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
} 
Run Code Online (Sandbox Code Playgroud)

响应.kt

import kotlinx.serialization.*
...
interface BaseResponse<T>

@Serializable
data class PaginatedResponse<T>(
    val prev: Int?,
    val next: Int?,
    val totalCount: Int = 0,
    val totalPages: Int = 0,
    val data: T? = null,
    val message: String? = null
) : BaseResponse<T>
Run Code Online (Sandbox Code Playgroud)

用法

...
  return PaginatedResponse<List<User>>(
                prev,
                next,
                totalCount,
                totalPages,
                users
            )
Run Code Online (Sandbox Code Playgroud)

我传递的数据看起来很健康 在此输入图像描述 接下来是返回时抛出的错误

kotlinx.serialization.SerializationException: Serializer for class 'PaginatedResponse' is not found.
Mark the …
Run Code Online (Sandbox Code Playgroud)

kotlin ktor kotlinx.serialization

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

升级到新的 React-Native 版本并执行 pod install 会引发错误 CocoaPods 无法找到 pod“SocketRocket”的兼容版本

我尝试将react-native版本更新到最新的0.72.3并运行pod install,这导致了下一个错误

[!] CocoaPods could not find compatible versions for pod "SocketRocket":
  In snapshot (Podfile.lock):
    SocketRocket (= 0.6.0, ~> 0.6.0)

  In Podfile:
    React-Core/RCTWebSocket (from `../node_modules/react-native/`) was resolved to 0.72.3, which depends on
      SocketRocket (= 0.6.1)

Specs satisfying the `SocketRocket (= 0.6.0, ~> 0.6.0), SocketRocket (= 0.6.1)` dependency were found, but they required a higher minimum deployment target.

Run Code Online (Sandbox Code Playgroud)

可能是什么问题?有正常的解决方法吗?

cocoapods socketrocket react-native

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

Ktor 测试无法序列化正文。内容类型为:class ...但需要 OutgoingContent

所以试图了解如何使用 testcontainers 测试 ktor 应用程序

这是我的代码

package com.app

import com.app.base.db.DbFactory
import com.app.features.auth.RegisterDTO
import com.app.plugins.*
import io.kotest.assertions.ktor.client.shouldHaveStatus
import io.kotest.core.extensions.install
import io.kotest.core.spec.style.FreeSpec
import io.kotest.extensions.testcontainers.JdbcTestContainerExtension
import io.ktor.client.*
import io.ktor.client.engine.apache.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.*
import io.ktor.server.plugins.contentnegotiation.*
import org.testcontainers.containers.PostgreSQLContainer
import io.ktor.server.testing.*
import kotlinx.serialization.json.Json
import org.jetbrains.exposed.sql.Database

class AuthSpec : FreeSpec({

    val postgres = PostgreSQLContainer<Nothing>("postgres").apply {
        withDatabaseName("test_appDB")
        startupAttempts = 1
        withUsername("test_viktor")
        withPassword("test_longPass")
        withExposedPorts(5432)
    }
    postgres.start()

    val ds = install(JdbcTestContainerExtension(postgres)) {
        poolName = "myconnectionpool"
        maximumPoolSize = 8
        idleTimeout = 10000
    }

    "register creator" - …
Run Code Online (Sandbox Code Playgroud)

serialization kotlin testcontainers ktor kotest

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

kotest更改环境变量

我正在使用 Kotests 为 Ktor 应用程序编写测试,但偶然发现了如何在全局范围内更改测试的环境变量的问题。我尝试过添加withEnvironment,但它给我带来了非常奇怪的错误

Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module java.base does not "opens java.util" to unnamed module @3daa422a
java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module java.base does not "opens java.util" to unnamed module @3daa422a
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
Run Code Online (Sandbox Code Playgroud)

我的测试文件看起来像这样

class VisitorSpec : FreeSpec({
    val ds = createDataSourceTest()

    val visitor = RegisterVisitorDTO(
        email = TestConstants.VISITOR_EMAIL,
        username = TestConstants.VISITOR_USERNAME,
        password = TestConstants.PASSWORD,
        firstName = TestConstants.VISITOR_FIRST_NAME,
        lastName = TestConstants.VISITOR_LAST_NAME,
        gender = …
Run Code Online (Sandbox Code Playgroud)

testing kotlin kotest

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

ktor 无法解析响应未找到转换:类 io.ktor.utils.io.ByteBufferChannel

我对 Kotlin 和 Ktor 比较陌生。在玩的时候,我试图解析来自 HTTP 响应的响应,但它总是向我抛出一个错误。

package com.example

import com.example.models.SpaceShip
import io.ktor.server.application.*
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.engine.apache.*
import io.ktor.client.request.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.http.*
import kotlinx.serialization.Serializable

fun main(args: Array<String>): Unit =
    io.ktor.server.netty.EngineMain.main(args)



@Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
fun Application.module() {

    install(ContentNegotiation) {
        json()
    }

    val client = HttpClient(Apache)

    routing {

        get("/spaceship") {
            val ship = SpaceShip("viktor", 2.2)
            call.respond(ship)
        }

        get("/consumeService") { …
Run Code Online (Sandbox Code Playgroud)

httpclient kotlin ktor

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

redux-devtools 跟踪选项卡未显示操作被调用者

我正在使用 redux-devtools,我已经按照文档中的说明配置了我的商店但跟踪未显示被调用者

const composeEnhancers =
  (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
      trace: true,
      traceLimit: 25
    })) ||
  compose;
Run Code Online (Sandbox Code Playgroud)

请帮助我如何获得工作代码。 实际行为

想要的行为

trace redux redux-devtools react-redux

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

箭头验证超过 10 个字段

我有一个问题,如何在 kotlin 中使用箭头验证超过 10 个值。

fun CreateEventDTO.validate(): Validated<IncorrectInput, CreateEventDTO> =
  name.isEventNameValid()
    .zip(
      about.isAboutValid(),
      phone.isPhoneValid(),
      price.isPriceValid(),
      location.isLocationValid(),
      startDate.isStartDateValid(),
   // TODO add common validation for date
      // endDate.isEndDateValid(),
      status.isEventStatusValid(),
      access.isEventAccessValid(),
      category.isEventCategoryValid(),
      musicStyles.isMusicStyleValid()
    )
    { name, _, _, price, location, status, access, category, musicStyles ->
      CreateEventDTO(
        name = name,
        about = about,
        phone = phone,
        price = price,
        location = location,
        startDate = startDate,
        endDate = endDate,
        status = status,
        access = access,
        category = category,
        musicStyles = musicStyles
      )
    }
    .mapLeft(ApiError::IncorrectInput)
Run Code Online (Sandbox Code Playgroud)

如果我尝试再添加一个验证,则会收到错误消息,因为 …

validation kotlin arrow-kt

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

安装时可能无法安装“wasm32-wasi”目标

为什么在安装时cargo build --target wasm32-wasi会抛出错误并提示没有安装。\n重现的步骤wasm32-wasi

\n
    \n
  1. 货运新列车
  2. \n
  3. rustup 目标添加 wasm32-wasi
  4. \n
  5. 货物构建--目标 wasm32-wasi
  6. \n
\n

接下来是控制台的输出

\n
\xe2\x9e\x9c  train git:(master) \xe2\x9c\x97 cargo build --target wasm32-wasi\n   Compiling train v0.1.0 (/user/playground/rustLang/train)\nerror[E0463]: can't find crate for `std`\n  |\n  = note: the `wasm32-wasi` target may not be installed\n  = help: consider downloading the target with `rustup target add wasm32-wasi`\n\nerror: cannot find macro `println` in this scope\n --> src/main.rs:2:5\n  |\n2 |     println!("hello");\n  |     ^^^^^^^\n\nerror: requires `sized` lang_item\n\nFor more information about this …
Run Code Online (Sandbox Code Playgroud)

rust rust-cargo rustup rust-wasm

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