gpt4 book ai didi

ios - swift 3 和 Alamofire : Extremely Slow Build Times

转载 作者:搜寻专家 更新时间:2023-11-01 06:03:12 25 4
gpt4 key购买 nike

因此,在诊断我的代码后,我将其缩小到一行导致我的整个项目的构建时间从几秒到几小时不等。我将参数传递给 Alamofire 以发送到我的 API,但它们会导致 Xcode 永远索引/构建。谁能知道为什么?

有问题的行

        var credit_union : String = ""
var activity : String = ""
var task : String = ""
var billing_options : String = ""

var sun : Float = 0
var mon : Float = 0
var tue : Float = 0
var wed : Float = 0
var thu : Float = 0
var fri : Float = 0
var sat : Float = 0
var total : Float = 0

var sun_notes : String = ""
var mon_notes : String = ""
var tue_notes : String = ""
var wed_notes : String = ""
var thu_notes : String = ""
var fri_notes : String = ""
var sat_notes : String = ""

let approval : String = ""
let department : String = currentUser.department
let submitted : String = "Not Submitted"
let date_of_time : Date = startDatePassing + 1.day
let id : Int = 0


let parameters: Parameters = [
"credit_union": credit_union,
"activity": activity,
"task" : task,
"billing_options" : billing_options,
"sun" : sun,
"mon" : mon,
"tue" : tue,
"wed" : wed,
"thu" : thu,
"fri" : fri,
"sat" : sat,
"total" : total,
"sun_notes" : sun_notes,
"mon_notes" : mon_notes,
"tue_notes" : tue_notes,
"wed_notes" : wed_notes,
"thu_notes" : thu_notes,
"fri_notes" : fri_notes,
"sat_notes" : sat_notes,
"approval" : approval,
"department" : department,
"submitted" : submitted,
"date_of_time" : date_of_time
]

最佳答案

因为有一个字典字面值,所以构建需要很长时间。您可以尝试使用 dict[key] = value 语法创建字典。

let parameters: Parameters = {
var dict = Parameters()
dict["credit_union"] = credit_union
dict["activity"] = activity
// the rest of the KVPs goes here
return dict
}()

关于ios - swift 3 和 Alamofire : Extremely Slow Build Times,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44315730/

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