PFLogInViewController
에는이 동작을 변경하기위한 후크가 없습니다. 사용자 정의 PFLogInViewController
서브 클래스를 빌드하고 로그인 실패시 경고보기를 표시하는 메소드를 대체 할 수 있습니다.
PFLogInViewController 코드 has been open sourced이므로 경고보기를 표시하는 방법은 _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];
}
하면 다음과 같은 경우 로그인이 실패 할 때, 당신은 경고를 표시 할 수 없습니다. 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];
}
@end
의 서브 클래스로 MYLogInViewController
을 정의하고 PFLogInViewController
MYLogInViewController *logInViewController = [[MYLogInViewController alloc] init];
logInViewController.delegate = self;
[self presentViewController:logInViewController animated:YES completion:nil];
대신 사용