aws Rekognition未在iOS上初始化

aws Rekognition未在iOS上初始化,ios,swift,aws-sdk,amazon-rekognition,Ios,Swift,Aws Sdk,Amazon Rekognition,对于图像中的AWS iOS文本识别,似乎几乎没有文档。我已经完成了AWS创建IAM的过程,并获得了进行Rekognition等操作的权限,我根据该配置文件在AWS上创建了我的“移动应用程序”,我得到了一个json文件,该文件包含在我的项目中 我正在初始化AWS“堆栈”,在应用程序委托中也没有问题 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIA

对于图像中的AWS iOS文本识别,似乎几乎没有文档。我已经完成了AWS创建IAM的过程,并获得了进行Rekognition等操作的权限,我根据该配置文件在AWS上创建了我的“移动应用程序”,我得到了一个json文件,该文件包含在我的项目中

我正在初始化AWS“堆栈”,在应用程序委托中也没有问题

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    AWSDDLog.add(AWSDDTTYLogger.sharedInstance)
    AWSDDLog.sharedInstance.logLevel = .info

    return AWSMobileClient.sharedInstance().interceptApplication(
        application,
        didFinishLaunchingWithOptions: launchOptions)
}
我的ViewController发生崩溃:

    override func viewDidLoad() {
    super.viewDidLoad()

    let rekognitionClient = AWSRekognition.default() // CRASH HERE BOOM

    let sourceImage = UIImage(named: "corolla")

    let image = AWSRekognitionImage()
    image!.bytes = UIImageJPEGRepresentation(sourceImage!, 0.7)

    guard let request = AWSRekognitionDetectLabelsRequest() else {
        puts("Unable to initialize AWSRekognitionDetectLabelsRequest.")
        return
    }

    request.image = image
    request.maxLabels = 3
    request.minConfidence = 90

    rekognitionClient.detectLabels(request) { (response:AWSRekognitionDetectLabelsResponse?, error:Error?) in
        if error == nil {
            print(response!)
        }
    }

}
这次事故表明:

2018-07-27 11:22:10.064126-0400 Plater[13491:5229604] *** Terminating app due    to uncaught exception 'NSInternalInconsistencyException', reason: 'The service configuration is `nil`. You need to configure `awsconfiguration.json`, `Info.plist` or set `defaultServiceConfiguration` before using this method.'
*** First throw call stack:
(
0   CoreFoundation                      0x0000000110d3e1e6 __exceptionPreprocess + 294
1   libobjc.A.dylib                     0x000000010d7d4031 objc_exception_throw + 48
2   AWSRekognition                      0x000000010caf19ac __36+[AWSRekognition defaultRekognition]_block_invoke + 492
3   libdispatch.dylib                   0x0000000111dc97ec _dispatch_client_callout + 8
4   libdispatch.dylib                   0x0000000111dcad64 dispatch_once_f + 285
5   AWSRekognition                      0x000000010caf1794 +[AWSRekognition defaultRekognition] + 84
6   Plater                              0x000000010bd6c5ec _T06Plater14ViewControllerC11viewDidLoadyyF + 124
7   Plater                              0x000000010bd6d364 _T06Plater14ViewControllerC11viewDidLoadyyFTo + 36
8   UIKit                               0x000000010e214131 -
据我所知,似乎我应该在json文件中配置Rekognion?在AWS网站上创建json文件时,我没有看到该选项


有什么想法吗?

我在尝试使用不同的AWS服务时遇到了相同的问题。将服务添加到我的
awsconfiguration.json
文件中,如下所示:

"Rekognition": {
    "Default": {
        "Region": "us-east-1"
    }
}

来源:我在文档中找不到这个,但是SDK是

您找到解决方案了吗?请分享