我已經將Swift 2.3項目轉換爲swift 3.現在,編譯器不再拋出任何錯誤,但它不斷編譯。 CPU是100%,如果你不停止編譯,它會持續編譯50分鐘或更長時間。Xcode繼續在Swift上構建3
Xcode一直說建築.. |編譯Swift源文件
在構建日誌中它總是停在相同的swift文件上。 swift文件只是簡單的模型類,所以我不知道這個問題會是什麼。
我在swift 2中遇到了同樣的問題,但這是由??
運算符造成的。我重構了代碼來刪除??
運營商,所以它不能再這樣了。
我怎樣才能找到什麼減慢編譯時間無盡?
我的模型看起來都一樣:
class Test: InputContract {
var appointmentDate: Date!
var startTime: String!
var endTime: String!
var registerDescription: String!
var subjectKey: String!
var channelCode: String!
var relationManagerHrId: String = ""
var employeeUserCode: String = ""
var smsReminderMobileNumber: String = ""
var smsReminderMobileNumberSequence: String!
var contactPhoneNumber: String = ""
var contactPhoneNumberSequence: String!
var smsReminder: Bool = false
override func retrieveInputDictionary() -> NSDictionary {
return ["description" : self.registerDescription, "appointmentDate" : Utils.formattedDate(self.appointmentDate),
"startTime" : self.startTime, "endTime" : self.endTime, "subjectKey" : self.subjectKey, "channelCode" : self.channelCode, "smsReminder" : self.smsReminder ? "true" : "false", "relationManagerHrId" : self.relationManagerHrId, "employeeUserCode" : self.employeeUserCode,
"smsReminderMobileNumber" : self.smsReminderMobileNumber, "contactPhoneNumber" : self.contactPhoneNumber, "smsReminderMobileNumberSequence" : self.smsReminderMobileNumberSequence, "contactPhoneNumberSequence" : self.contactPhoneNumberSequence
]
}
}
InputContract是:
protocol InputDictionaryMapper {
func retrieveInputDictionary() -> NSDictionary
func retrievePublicInputDictionary() -> NSDictionary
}
class InputContract: Model, InputDictionaryMapper {
func retrieveInputDictionary() -> NSDictionary {
fatalError("Each inputContract implementation must implement it's own method: \(NSStringFromClass(type(of: self)))")
}
func retrievePublicInputDictionary() -> NSDictionary {
fatalError("Each inputContract implementation must implement it's own method: \(NSStringFromClass(type(of: self)))")
}
required init(json: JSON) {
fatalError("init(json:) has not been implemented")
}
override init() {
super.init()
}
}
和型號僅僅是一個擁有另一個初始化爲JSON過的基類。
當我在構建日誌上運行分析器,然後我所有的模型都花費很長時間來創建NSDictionary。但爲什麼?
1.您是否嘗試清理項目/重新啓動Xcode/etc? 2.你有沒有試過在單獨的項目中編譯這個Swift文件? 如果不是,請發佈它掛起的Swift文件的內容。 – fiks
你好,我有同樣的問題,你有任何解決方案? – Rock
@fiks我和班級編輯了我的問題。 – user1007522