2020-02-17 23:12:31.949254+0100 LoyaltyCardsApp[64133:7104122] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OTPViewController OTPPinInserted:pin:]: unrecognized selector sent to instance 0x7fd00a127730'
@protocol OTPViewControllerDelegate
- (void) OTPAbortedByUser;
- (void) OTPPinInserted: (NSString *) pan pin: (NSString *) pin;
@end
@interface OTPViewController : UIViewController<KeyboardDelegate>
@property (nonatomic, strong) id delegate;
@property (nonatomic, weak) IBOutlet UIButton *confirmButton;
@property (weak, nonatomic) IBOutlet InputTextView *insertOTP;
@property (nonatomic, strong) NSString* stringInserted;
@property (weak, nonatomic) IBOutlet CopyableTextView *result;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *marginTop;
- (IBAction) clickOnDoneButton:(id)sender;
@end
- (void) pinInserted:(NSString *) pin{
[self.delegate OTPPinInserted:self.insertOTP.input.text pin:pin];
the crash occurs here:
[self.delegate OTPPinInserted:self.insertOTP.input.text pin:pin];
other thing, I can't understand why in debug I can't go inside the if ..
if (self.delegate && [self.delegate respondsToSelector:@selector(OTPPinInserted:pin:)]){
[self.delegate OTPPinInserted:self.insertOTP.input.text pin:pin];
}
OTPPinInserted:pin
method? – AjinkyaSharmaif
block, because it is not able to find theOTPPinInserted:pin
method implemented. – AjinkyaSharmadelegate
variable withweak
property, the strong property will lead to memory issues. – Kampai