【问题标题】:AWS Transcribe stuck in getTranscriptionJob in iOSAWS Transcribe 卡在 iOS 中的 getTranscriptionJob 中
【发布时间】:2019-11-27 00:27:35
【问题描述】:

我正在尝试在使用 aws-sdk-ios 的 iOS 应用程序中使用 AWS Transcribe。该应用程序启动一个转录作业,我可以在 AWS 控制台上看到该作业。但是该应用程序无法列出作业或获取特定作业,因为它卡在对getTranscriptionJoblistTranscriptionJobs 的请求中,因为这些请求永远不会完成(我在完成块中添加了一个打印语句和一个断点,并且它永远不会打印,也不会到达断点)。

我将演示问题的示例单视图应用程序上传到 GitHub。您需要一个对 S3 和 Transcribe 具有完全权限的 AWS 账户或 IAM 用户。在 ViewController.swift 中的相应变量中插入该帐户的密钥和 S3 存储桶。

https://github.com/joaomarceloods/AWSTranscribeBug

我需要帮助。这是一个错误,还是我做错了什么?

Swift、iOS 13.2、CocoaPods、AWSCore 2.12.1、AWSTranscribe 2.12.1

最重要的sn-p:

    /// `getTranscriptionJob` repeatedly until the status is no longer `inProgress`.
    /// However, `getTranscriptionJob` never completes.
    var transcriptionInProgress = true
    while transcriptionInProgress {
        print("getTranscriptionJob")
        transcribe.getTranscriptionJob(request).continueWith { task -> Any? in
            print("getTranscriptionJob never completes...")
            let transcriptionJob = task.result?.transcriptionJob
            transcriptionInProgress = transcriptionJob?.transcriptionJobStatus == .inProgress
            return nil
        }.waitUntilFinished()
    }
    print("...after the getTranscriptionJob")

【问题讨论】:

    标签: ios aws-sdk-ios aws-transcribe


    【解决方案1】:

    我找到了解决办法。

    我还是不明白为什么getTranscriptionJob会死机,但是如果你在DispatchQueue.global()上运行它就会正常执行:

    .continueWith(executor: AWSExecutor(dispatchQueue: DispatchQueue.global())) {
    

    示例代码差异:https://github.com/joaomarceloods/AWSTranscribeBug/commit/98e43af553413ed2bbd0c3f96e259139a991303e

    参考:https://aws-amplify.github.io/docs/ios/how-to-ios-asynchrounous-tasks#executing-a-block-on-the-main-thread-with-awstask

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-13
      • 1970-01-01
      • 1970-01-01
      • 2022-06-28
      相关资源
      最近更新 更多