2
我的應用程序在除iphone 6s plus之外的所有設備上都使用alamofire 4.0.1完美上傳照片(在iPhone 4s,5.5s,6,7,7plus上使用9.2和10.1版本進行測試)Alamofire僅在iPhone 6s上載時崩潰
let image = profileimage
Alamofire.upload(multipartFormData: { multipartFormData in
// import image to request
if let imageData = UIImageJPEGRepresentation(image!, 1) {
multipartFormData.append(imageData, withName: "user_profile.profile_picture", fileName: "profile_picture"+NSUUID().uuidString, mimeType: "image/png")
}
},
usingThreshold: SessionManager.multipartFormDataEncodingMemoryThreshold,
to: baseURL+String(currentUser.id)+"/",
method: .put,
headers: headers,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON { response in
let user = createUserFromJSON(response.result.value as! NSDictionary) //crashes here, response is nil
completion(user, nil)
}
case .failure(let encodingError):
let error = encodingError
completion(nil, error)
}
})
在iPhone 6S再加上它崩潰與此:
2016-12-02 13:26:04.391264 app[22207:366529] [] nw_socket_get_input_frames recvmsg(fd 14, 1024 bytes): [54] Connection reset by peer
2016-12-02 13:26:04.393678 app[22207:366529] [] nw_endpoint_flow_prepare_output_frames [3.1 52.17.90.251:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
2016-12-02 13:26:04.394564 app[22207:366529] [] nw_socket_write_close shutdown(14, SHUT_WR): [57] Socket is not connected
2016-12-02 13:26:04.394945 app[22207:366529] [] nw_endpoint_flow_service_writes [3.1 52.17.90.251:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2016-12-02 13:26:04.396875 app[22207:366613] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
哪個ios版本在iPhone 6 plus? –
它在IOS版本10.1和9.2上崩潰 – Stav1
你已經測試了你的應用程序的所有這些設備,意味着你正在使用iPhone模擬器或實際設備?典型的圖像有多大? –