PFLogInViewController
この動作を変更するためのフックを提供しません。独自のカスタムPFLogInViewController
サブクラスを作成し、ログインが失敗したときにアラート ビューを表示するメソッドをオーバーライドすることができます。
PFLogInViewController のコードはオープンソース化されているので、それによるとアラートビューを表示するメソッドは_loginDidFailWithError
.
https://github.com/ParsePlatform/ParseUI-iOS/blob/master/ParseUI/Classes/LogInViewController/PFLogInViewController.m#L382-L390
- (void)_loginDidFailWithError:(NSError *)error {
if (_delegateExistingMethods.didFailToLogIn) {
[_delegate logInViewController:self didFailToLogInWithError:error];
}
[[NSNotificationCenter defaultCenter] postNotificationName:PFLogInFailureNotification object:self];
NSString *title = NSLocalizedString(@"Login Error", @"Login error alert title in PFLogInViewController");
[PFUIAlertView showAlertViewWithTitle:title error:error];
}
例えば以下のような場合、ログイン失敗時のアラート表示を非表示にできます。MYLogInViewController
のサブクラスとして定義PFLogInViewController
@interface MYLogInViewController : PFLogInViewController
@end
@implementation MYLogInViewController
- (void)_loginDidFailWithError:(NSError *)error {
if ([self.delegate respondsToSelector:@selector(logInViewController:didFailToLogInWithError:)]) {
[self.delegate logInViewController:self didFailToLogInWithError:error];
}
[[NSNotificationCenter defaultCenter] postNotificationName:PFLogInFailureNotification object:self];
NSString *title = NSLocalizedString(@"Login Error", @"Login error alert title in PFLogInViewController");
//
// Implement to display your custom alert view
//
}
@end
代わりにそれを使用してくださいPFLogInViewController
MYLogInViewController *logInViewController = [[MYLogInViewController alloc] init];
logInViewController.delegate = self;
[self presentViewController:logInViewController animated:YES completion:nil];