Приведенный ниже код генерирует эту ошибку с помощью AWS Transcribe на iOS:
Задача <1B377509-91AE-43C0-8F24-F28FE7B583AC>. <1> Сбой загрузки с ошибкой Ошибка Domain = NSURLErrorDomain Code =-1003 "Сервер с указанным именем хоста не найден."UserInfo = {_ kCFStreamErrorCodeKey = 8, NSUnderlyingError = 0x283cb55f0 {Ошибка домена = kCFErrorDomainCFNetwork код = -1003 "(нуль)" UserInfo = {_ kCFStreamErrorCodeKey = 8, _kCFStreamErrorDomainKey = 12}}, _NSURLErrorFailingURLSessionTaskErrorKey = LocalDataTask <1B377509-91AE-43C0-8F24-F28FE7B583AC>. <1>, _NSURLErrorRelatedURLSessionTaskErrorKey = ("LocalDataTask <1B377509-91AE-43C0-8F24-F28FE7B583AC>. <1>"), NSLocalizedDescription = Сервер с указанным именем хоста не найден., NURL = 1005 ** *** -west-1.amazonaws.com / , NSErrorFailingURLKey = https://transcribe.us -west-1.amazonaws.com / , _kCFStreamErrorDomainKey = 12} [-1003]
US-West1 - поддерживаемый регион для AWS Transcribe.Почему происходит эта ошибка?
class TranscriptionNewViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
// =============================================================================================================
// MARK: Transcription Functions
// =============================================================================================================
fileprivate func transcribe() {
let fileURL = "https://s3-us-west-2.amazonaws.com/blahblahblah/Sample1.mp3"
let jobName = "sample1"
let languageCode = AWSTranscribeLanguageCode.enUS
let mediaFormat = AWSTranscribeMediaFormat.mp3
let media = AWSTranscribeMedia()
media?.mediaFileUri = fileURL
let jobRequest = AWSTranscribeStartTranscriptionJobRequest()
jobRequest?.transcriptionJobName = jobName
jobRequest?.languageCode = languageCode
jobRequest?.mediaFormat = mediaFormat
jobRequest?.media = media
let transcribeClient = AWSTranscribe.default()
DispatchQueue.global(qos: .background).async {
transcribeClient.startTranscriptionJob(jobRequest!) { response, error in
guard let response = response else {
print("Failed to start transcription")
return
}
print(response.transcriptionJob!.transcriptionJobStatus == .inProgress, "Status should have been in progress, but was \(response.transcriptionJob!.transcriptionJobStatus)")
self.transcribeJobDidFinish()
}
}
// Print status
print("Started transcription")
}
fileprivate func transcribeJobDidFinish() {
}
// =============================================================================================================
// MARK: IB Actions
// =============================================================================================================
@IBAction func transcribeButtonDidTap(_ sender: UIButton) {
transcribe()
}
// =============================================================================================================
// MARK: UIViewController Functions
// =============================================================================================================
override var prefersStatusBarHidden: Bool {
return true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}