AWSAuthUI.bundle未加载且服务配置为零

时间:2018-07-04 14:09:58

标签: ios swift aws-sdk

当我的AWSAuthUIViewController出现时,我会收到此警告,但视图呈现得很好并且似乎可以正确执行:Cannot find executable for CFBundle 0x10d012a80 </var/containers/Bundle/Application/A0DB0060-6E38-4FEA-946D-5A203BCE31A4/Kliber.app/AWSAuthUI.bundle> (not loaded)

当我按下任意按钮(登录,创建帐户或忘记密码)时,出现此错误并崩溃:The service configuration is nil. You need to configure Info.plist before using this method.

我认为我正确地遵循了iOS教程,所以我不知道哪里出了问题。也许我的plist或aws.json中缺少某些内容

我的SSO / AWSAuth UI代码:

  override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.presentAuthUIViewController()
    }

    func presentAuthUIViewController() {
        let config = AWSAuthUIConfiguration()
        config.enableUserPoolsUI = true
        config.font = UIFont (name: "Helvetica Neue", size: 15)
        config.canCancel = true

            AWSAuthUIViewController.presentViewController(with: self.navigationController!, configuration: config, completionHandler: { (provider: AWSSignInProvider, error: Error?) in
                if error == nil {
                    // SignIn succeeded.
                    print("SSO WORK")
                } else {
                    print("SSO ERROR")
                }
            })
    }

我的.plist AWS密钥:

<key>AWS</key>
    <dict>
        <key>Cognito</key>
        <dict>
            <key>Region</key>
            <string>eu-west-1</string>
        </dict>
        <key>CredentialsProvider</key>
        <dict>
            <key>CognitoIdentity</key>
            <dict>
                <key>Default</key>
                <dict>
                    <key>PoolId</key>
                    <string>foo</string>
                    <key>Region</key>
                    <string>eu-west-1</string>
                </dict>
            </dict>
        </dict>
    </dict>

我的AWS .json

 {
    "UserAgent": "MobileHub/1.0",
    "Version": "1.0",
    "CredentialsProvider": {
        "CognitoIdentity": {
            "Default": {
                "PoolId": "foo",
                "Region": "eu-west-1"
            }
        }
    },
    "IdentityManager": {
        "Default": {}
    },
    "PinpointAnalytics": {
        "Default": {
            "AppId": "foo",
            "Region": "us-east-1"
        }
    },
    "PinpointTargeting": {
        "Default": {
            "Region": "us-east-1"
        }
    },
    "CognitoUserPool": {
        "Default": {
            "AppClientSecret": "foo",
            "AppClientId": "foo",
            "PoolId": "foo",
            "Region": "eu-west-1"
        }
    }
}

0 个答案:

没有答案