gpt4 book ai didi

swift - 在 Alamofire 中上传带有深度参数的图像

转载 作者:行者123 更新时间:2023-11-30 10:47:24 25 4
gpt4 key购买 nike

如何在Alamofire中上传具有此类参数的图像

{
"user_email":"johndoe@yopmail.com",
"user_token":"yiDmaVs6Ax-zUj1cM-Eh",
"claim_id": 6,
"items":[{
"name":"Watch",
"name_of_owner": "Selena Gomez",
"phone_of_owner": "091237462",
"email_of_owner": "selenagomez@gmail.com",
"quantity":1,
"is_owned": false,
"photo":"image data here..."
},{
"name":"iMac",
"name_of_owner": "Steff Gomez",
"phone_of_owner": "091237462",
"email_of_owner": "selenagomez@gmail.com",
"quantity":1,
"is_owned": false,
"photo": "image data here..."
}]

}

如果您认为这不是我们应如何处理每个项目的图像上传的最佳实践。请赐教。

最佳答案

    var bannerImage = [[String:AnyObject]]()
var fileIDSArr = [String]() // these are how many images you want to load
for i in 0..<fileIDSArr.count
{
let imageId:String = fileIDSArr[i]
bannerImage.append([ "name":"Watch" as AnyObject,
"name_of_owner": "Selena Gomez" as AnyObject,
"phone_of_owner": "091237462" as AnyObject,
"email_of_owner": "selenagomez@gmail.com" as AnyObject,
"quantity":1 as AnyObject,
"is_owned": false as AnyObject,
"photo":"image data here..." as AnyObject])
}

var params = [String:Any]()
params = ["user_email":"johndoe@yopmail.com",
"user_token":"yiDmaVs6Ax-zUj1cM-Eh",
"claim_id": 6,
"items":bannerImage]

关于swift - 在 Alamofire 中上传带有深度参数的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55470773/

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