The feature is to upload photos via AWS and the keys are obtained from our respective servers to upload a photo in case the keys are expired. As per logs the app crashes in newProcessS3Upload
line in the below func. Please find the complete stack trace in the attachment.
func newRetrieveS3Credentials(uploadObject:NSDictionary) {
let type = uploadObject.object(forKey: "type") as? NSNumber ?? 0
guard let signatureUploadRequest:URLRequest = self.retrieveSignatureUploadURLRequest() else{
return
}
let defaultSession:URLSession = URLSession.shared
let dataTask = defaultSession.dataTask(with: signatureUploadRequest, completionHandler: { data, response, error in
if let httpResponse = response as? HTTPURLResponse, let data = data {
if httpResponse.statusCode == 200 {
do {
let responseDictionary = try JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed) as? [String: Any]
self.newCredentialsRetrieved(credentialsDict: responseDictionary ?? [:])
DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) {
self.newProcessS3Upload(uploadObject: uploadObject)
}
}
catch let jsonError{
self.log.i("S3Manager: Json serialzation error: \(String(describing: jsonError))")
}
} else {
self.log.i("S3Manager: Error with S3 JSON request: \(error.debugDescription)")
let delegate = uploadObject.object(forKey: "delegate")
if let delegate = delegate as? S3Observer{
self.delegate = delegate
}
if type.intValue == UploadType.SIGNATURE_TYPE.rawValue {
DispatchQueue.global(qos: .userInitiated).async {
DispatchQueue.main.async {
self.delegate?.signatureFailedToUpload?(forStop: self.uploadSignature?.stopId, withError: error.debugDescription)
}
}
}else if type.intValue == UploadType.ITEM_PHOTO_TYPE.rawValue && ((self.delegate?.responds(to: #selector(S3Observer.errorOccured(_:)))) != nil) {
self.delegate?.errorOccured?(error)
}
self.log.i("S3Manager: Unknown S3 upload Error: \(error.debugDescription)")
}
}
})
dataTask.resume()
}
The crash log is as follows:
Crashed: com.apple.root.default-qos
0 WISE Driver 0x14e4a4 S3Manager.newProcessS3Upload(uploadObject:) + 4331070628 (S3Manager.swift:4331070628)
1 WISE Driver 0x1520c4 partial apply for closure #1 in closure #1 in S3Manager.newRetrieveS3Credentials(uploadObject:) + 4331086020 (<compiler-generated>:4331086020)
2 WISE Driver 0x1409a8 thunk for @escaping @callee_guaranteed () -> () + 4331014568 (<compiler-generated>:4331014568)
3 libdispatch.dylib 0x3f88 _dispatch_client_callout + 20
4 libdispatch.dylib 0x7418 _dispatch_continuation_pop + 504
5 libdispatch.dylib 0x1aa58 _dispatch_source_invoke + 1588
6 libdispatch.dylib 0x6f54 _dispatch_queue_override_invoke + 500
7 libdispatch.dylib 0x15a6c _dispatch_root_queue_drain + 396
8 libdispatch.dylib 0x16284 _dispatch_worker_thread2 + 164
9 libsystem_pthread.dylib 0xdbc _pthread_wqthread + 228
10 libsystem_pthread.dylib 0xb98 start_wqthread + 8
com.apple.main-thread
0 libsystem_kernel.dylib 0xda8 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13a1c mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13c5c mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x12ec mach_msg + 24
4 CoreFoundation 0x7aac4 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd08 __CFRunLoopRun + 1232
6 CoreFoundation 0x80eb0 CFRunLoopRunSpecific + 612
7 GraphicsServices 0x1368 GSEventRunModal + 164
8 UIKitCore 0x3a1668 -[UIApplication _run] + 888
9 UIKitCore 0x3a12cc UIApplicationMain + 340
10 WISE Driver 0x46ac main + 14 (main.m:14)
11 ??? 0x1f5294960 (Missing)
Your help is greatly appreciated.
Thanks,
DebWisesystems