如何上傳圖像陣列多部分身體把它隨着莫亞Swift3上傳圖片多部分隨着莫亞斯威夫特3全例如
我的代碼
var multipartBody: [MultipartFormData]? {
switch self {
case .registerWith(let registrationObject):
if let profileImageData = registrationObject.profileImageData{
return [MultipartFormData(provider: .data(profileImageData), name: "profile_picture", fileName: "\(registrationObject.phone).jpg",
mimeType: "image/jpeg")]
}
return nil
default:
return nil
}
}
var task: Task {
switch self {
case .registerWith:
if let multipartBody = multipartBody {
return .upload(.multipart(multipartBody))
}else{
return .request
}
default:
return .request
}
}
,但我需要發送的imageData中體鍵「profileImage」