gpt4 book ai didi

linux 环境下 Swift Perfect 编译命令失败

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:58 25 4
gpt4 key购买 nike

我正在尝试创建 Swift Perfect 项目。我正在尝试发送一个链接的响应。我的类(class)如下所示

class Model: JSONConvertibleObject {

static let registerName = "prospect"

var userEmail = ""
var authToken = ""
var firstName = ""
var lastName = ""
var email = ""
var countryCode = 0
var phone = 0

var mobile = 0
var homeNo = 0
var gender = ""
var age = ""
var martialStatus = ""
var spiritualCondition = ""
var language = ""
var notes = ""

let constants = SwConstants.JsonConstants()

override func setJSONValues(_ values: [String : Any]) {
self.firstName = getJSONValue(named: constants.firstName, from: values, defaultValue: "")
self.lastName = getJSONValue(named: constants.lastName , from: values, defaultValue: "")
self.email = getJSONValue(named: constants.email, from: values, defaultValue: "")
self.countryCode = getJSONValue(named: constants.countryCode, from: values, defaultValue: 0)

self.mobile = getJSONValue(named: constants.mobile, from: values, defaultValue: 0)
self.homeNo = getJSONValue(named: constants.homeNo, from: values, defaultValue: 0)
self.gender = getJSONValue(named: constants.email, from: values, defaultValue: "")
self.age = getJSONValue(named: constants.age, from: values, defaultValue: "")
self.language = getJSONValue(named: constants.language, from: values, defaultValue: "")
self.spiritualCondition = getJSONValue(named: constants.spiritualCondition, from: values, defaultValue: "")


}

override func getJSONValues() -> [String : Any] {

return [
JSONDecoding.objectIdentifierKey:ProspectModel.registerName,
constants.firstName:firstName,
constants.lastName:lastName,
constants.email: email,
constants.countryCode :countryCode,
constants.phone: phone,

constants.mobile: mobile,
constants.homeNo: homeNo,
constants.gender:gender,
constants.age:age,
constants.martialStatus: martialStatus,
constants.language:language,
constants.spiritualCondition:spiritualCondition

]

}

}

一旦我添加了 spiritualCondition 并尝试使用 Docker 在 Swift Asistant 中编译构建,MacOS 构建就成功构建了。但是,linux 构建出错了

<unknown>:0: error: unable to execute command: Killed
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
Failed: systemError(1, "sh: no job control in this shell\n<unknown>:0: error: build had 1 command failures\nswift-build: error: exit(1): /swift-3.0.2-RELEASE-ubuntu16.04/usr/bin/swift-build-tool -f /perfectbuild/.build_lin/release.yaml\n")

任何人都可以向我解释问题是什么吗?我是 Swift Perfect 的新手。我也不能变得冗长。如果有人解释如何使构建冗长,那将非常有帮助。

最佳答案

首先,你应该试试完美助手2,它现在可以选择Swift 3.1或更高版本在这个应用程序中编译。其次,我不知道你的“SwConstant”,所以我无法编译你的代码。

但是,此代码段已由 PA2 在 OS X 和 Linux 上进行了测试:

import PerfectLib

class User: JSONConvertibleObject {
static let registerName = "user"
var firstName = ""
var lastName = ""
var age = 0
override func setJSONValues(_ values: [String : Any]) {
self.firstName = getJSONValue(named: "firstName", from: values, defaultValue: "")
self.lastName = getJSONValue(named: "lastName", from: values, defaultValue: "")
self.age = getJSONValue(named: "age", from: values, defaultValue: 0)
}
override func getJSONValues() -> [String : Any] {
return [
JSONDecoding.objectIdentifierKey:User.registerName,
"firstName":firstName,
"lastName":lastName,
"age":age
]
}
}

JSONDecoding.registerJSONDecodable(name: User.registerName, creator: { return User() })

let user = User()
user.firstName = "Donnie"
user.lastName = "Darko"
user.age = 17

if let encoded = try? user.jsonEncodedString() {
print(encoded)
if let u = try? encoded.jsonDecode() as? User, let v = u {
print(v.age, v.firstName, v.lastName)
}
}

祝你好运。

关于linux 环境下 Swift Perfect 编译命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44096985/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com