ios – AWSS3 Region / plist配置问题’服务配置为`nil`

我正面临着AWSS3的一个奇怪问题.

建立:

> AWS Mobile HUB
> Cognito
> DynamoDB
> S3

– > Cognito,Dynamo&甚至S3(通过认知用户数据)工作.

但是我现在尝试使用以下代码直接连接到AWS3:“

let transferManager = awss3transfermanager.default()
                            let uploadRequest = awss3transfermanagerUploadRequest()
                            uploadRequest?.bucket = "XXXXXXXXXXXX"
                            uploadRequest?.key = "user-data/" + awsId! + "/primary_profile_picture.png"
                            uploadRequest?.body = imgurl as URL

                            transferManager.upload(uploadRequest!).continueWith(executor: AWSExecutor.mainThread(),block: { (task:AWSTask<AnyObject>) -> Any? in

                                if let error = task.error as? NSError {
                                    if error.domain == awss3transfermanagerErrorDomain,let code = awss3transfermanagerErrorType(rawValue: error.code) {
                                        switch code {
                                        case .cancelled,.paused:
                                            break
                                        default:
                                            print("Error uploading: \(uploadRequest?.key) Error: \(error)")
                                        }
                                    } else {
                                        print("Error uploading: \(uploadRequest?.key) Error: \(error)")
                                    }
                                    return nil
                                }

                                let uploadOutput = task.result
                                print("Upload complete for: \(uploadRequest?.key)")
                                return nil
                            })

并得到错误

AWSiOSSDK v2.5.1 [Debug] AWSInfo.m line:122 | -[AWSServiceInfo initWithInfoDictionary:checkRegion:] | Couldn't read the region configuration from Info.plist for the client. Please check your `Info.plist` if you are providing the SDK configuration values through `Info.plist`.
2017-02-20 19:29:21.748997 [2210:1152801] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException',reason: 'The service configuration is `nil`. You need to configure `Info.plist` or set `defaultServiceConfiguration` before using this method.'

我正在使用从AWS Mobiel HUB下载的plist配置,因此它有点惊讶它不起作用(正如所有其他组件那样).

任何想法可能是什么问题? plist实际上包含桶ID&地区.

解决方法

您的info.plist需要包含S3TransferManager.

所以,** AWS – > S3TransferManager – >认 – >地区 – > … **

你可以找到一个here的例子

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...