我将通过为这样一个开放式问题道歉来开始这个问题,但我真的很挣扎,而且所有文档都已过时了。
亚马逊提供的示例应用尚未更新,尝试运行时只会出现错误。我有一个登录页面设置,准备好使用电子邮件和密码,我已经尝试了这段代码:
@IBAction func signInButtonTouched(sender: UIButton) {
if (emailTextField.text != nil) && (passwordTextField.text != nil) {
let user = (UIApplication.sharedApplication().delegate as! AppDelegate).userPool!.getUser(emailTextField.text!)
user.getSession(emailTextField.text!, password: passwordTextField.text!, validationData: nil, scopes: nil).continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock: {
(task:AWSTask!) -> AnyObject! in
if task.error == nil {
// user is logged in - show logged in UI
} else {
// error
}
return nil
})
} else {
// email or password not set
}
}
但不幸的是我得到了App Delegate没有会员" userPool"错误。虽然它确实!我对此非常陌生,我已经搜索了github并阅读了所有亚马逊的样本,但文档要么是Objective-C,要么是过时的,并且不能正常工作。
对此的任何帮助都将非常感激。