weakSelf.agsResumableTaskJob = weakSelf.gdbSyncTask?.generateGeodatabaseWithParameters(params, downloadFolderPath: nil, useExisting: false, status: { status, userInfo in if let userinfo = userInfo { if let error = userinfo["statusRequestError"] { print("Error: Could not generate geodatabase. Error details:\(error)") errorOccured = true weakSelf.agsResumableTaskJob?.cancel() if error.localizedDescription == "The Internet connection appears to be offline." { dispatch_async(dispatch_get_main_queue()) { let alert = UIAlertController(title: "Network Error", message: "Could not download the map inventory.Please verify you are connected to the Network and try again.", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)) weakSelf.presentViewController(alert, animated: true, completion: nil) } } else if error.localizedDescription == "A server with the specified hostname could not be found." { dispatch_async(dispatch_get_main_queue()) { let alert = UIAlertController(title: "Network Error", message: "Could not download the map inventory.Please verify you are connected to the Network and try again.", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)) weakSelf.presentViewController(alert, animated: true, completion: nil) } } else { dispatch_async(dispatch_get_main_queue()) { let alert = UIAlertController(title: "Error", message: "Could not download the map inventory.Please verify you are connected to the Network and try again.", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)) weakSelf.presentViewController(alert, animated: true, completion: nil) } } } } |