中止陷阱:6 在带有类型别名定义的协议扩展中
Abort trap: 6 in protocol extension with typealias definitions
我有以下代码可以在 Xcode 9.2 标准构建系统和 swift build -c release
中编译和运行,但是当使用 [=13= 构建项目时它不会编译并给出 abort trap: 6
] 或 swift build
import Foundation
protocol RestProtocol {
associatedtype PostModelType: Codable
associatedtype GetModelType: Codable
associatedtype PostResponseType: Codable
}
extension RestProtocol {
static func consume(with: [String: Any],
completion: @escaping (GetModelType?, Error?) -> Void) {
completion(nil, nil)
}
static func produce(with: PostModelType,
completion: @escaping (PostResponseType?, Error?) -> Void) {
completion(nil, nil)
}
}
struct Model<T: Codable>: Codable {
var code: Int?
var message: String?
var success: Bool?
var result: T?
}
struct Service: RestProtocol {
typealias PostModelType = DetailsModel
typealias GetModelType = Model<DetailsModel>
typealias PostResponseType = Model<DetailsModel>
}
struct DetailsModel: Codable {
var response: String?
}
Service.consume(with: ["Key": "value"]) { (response, error) in
print("This compiles in Xcode and swift build -c release but gives Abort trap: 6 in swift build")
}
提前感谢您的帮助。
显然这是构建系统中的一个问题,在 Xcode 中混淆了区分大小写的文件命名。
在同一模块中包含 Account.swift
和 account.swift
等文件会导致错误。
我有以下代码可以在 Xcode 9.2 标准构建系统和 swift build -c release
中编译和运行,但是当使用 [=13= 构建项目时它不会编译并给出 abort trap: 6
] 或 swift build
import Foundation
protocol RestProtocol {
associatedtype PostModelType: Codable
associatedtype GetModelType: Codable
associatedtype PostResponseType: Codable
}
extension RestProtocol {
static func consume(with: [String: Any],
completion: @escaping (GetModelType?, Error?) -> Void) {
completion(nil, nil)
}
static func produce(with: PostModelType,
completion: @escaping (PostResponseType?, Error?) -> Void) {
completion(nil, nil)
}
}
struct Model<T: Codable>: Codable {
var code: Int?
var message: String?
var success: Bool?
var result: T?
}
struct Service: RestProtocol {
typealias PostModelType = DetailsModel
typealias GetModelType = Model<DetailsModel>
typealias PostResponseType = Model<DetailsModel>
}
struct DetailsModel: Codable {
var response: String?
}
Service.consume(with: ["Key": "value"]) { (response, error) in
print("This compiles in Xcode and swift build -c release but gives Abort trap: 6 in swift build")
}
提前感谢您的帮助。
显然这是构建系统中的一个问题,在 Xcode 中混淆了区分大小写的文件命名。
在同一模块中包含 Account.swift
和 account.swift
等文件会导致错误。