对于Linux环境,Swift Perfect编译命令失败

时间:2017-05-21 12:40:58

标签: swift linux docker perfect

我正在尝试在Swift Perfect项目上创建。我正在尝试为链接发送一个响应。我的课程如下:

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

        ]

    }

}

当我添加spiritCondition并尝试使用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的新手。我也不能得到冗长。如果有人解释如何使构建详细,那将非常有用。

1 个答案:

答案 0 :(得分:0)

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

但是,这个代码片段已在OS X&amp; Linux by PA2:

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)
  }
}
祝你好运。