【发布时间】:2011-05-16 03:24:43
【问题描述】:
我有一个 Authenticator 类,它有一个使用 API 密钥进行身份验证的方法和另一个使用电子邮件地址和密码进行身份验证的方法。身份验证是通过异步 HTTP 请求完成的。
我有一个 LoginController 来管理用户将输入其电子邮件/密码的视图。
这是一个代码sn-p:
// LoginController
- (void)awakeFromNib {
self.authenticator = [[Authenticator alloc] init];
}
- (IBAction)authenticateWithEmailAndPassword: (id)sender {
// Async HTTP request, so we can't just check the return
// value to see if authentication was successful or not
[self.authenticator authenticateWithEmail:[emailField stringValue]
password:[passwordField stringValue]];
}
我的Authenticator 对象进行身份验证,我的LoginController 需要异步结果(成功或失败)。
Objective C 从模型到控制器的异步通信方式是什么?
【问题讨论】: