由 CyanHall.com
创建于 2020-12-23,
上次更新:2021-03-30。
👉 如果有用请点赞。
👉 如果有用请点赞。
var photos = [[String: String]] = []
var photoMap: [Data: String] = [:]
let group = DispatchGroup()
// Upload photo
for imageData in imageDataList {
group.enter()
DispatchQueue.global().async {
API.updateFile(data: imageData, success: { (url) in
photoMap[imageData] = url
group.leave()
}) { (error) in
group.leave()
}
}
}
// All photo uploaded
group.notify(queue: DispatchQueue.main) {
for imageData in imageDataList {
let item = [
"url": photoMap[imageData]!,
]
photos.append(item)
}
print(photos)
}
更多