我有一个 pinpad 类,每次输入后都会对其上的按钮进行打乱。该类作为一个单独的项目可以完美地工作,但是当添加到一个特定的项目时,我会收到一条[__NSCFSet stringByAppendingFormat:]: unrecognized selector sent to instance
消息。这是触发该消息的方法:
-(void)touchedButtonInCell:(id)sender
{
// Obtain the current number string entered from the pinpad.
_pinpadNumber = [_pinpadNumber stringByAppendingFormat:@"%i", [sender tag]];
// Verification of values
NSLog(@"%i", [sender tag]);
NSLog(@"%@", _pinpadNumber);
// Check the entry of the PINPAD_NUMBER_LENGTH character/number
if ([_pinpadNumber length] >= PINPAD_NUMBER_LENGTH)
{
// Trigger delegate method to handle the pin pad number received.
if ([_delegate respondsToSelector:@selector(receivedPinPadNumber:)])
{
[_delegate receivedPinPadNumber:_pinpadNumber];
}
// Reset the contents of the pin pad number string
_pinpadNumber = @"";
}
// Ensure all elements are scrambled for next number entry.
[self scramblePinpadGridView];
}
如果我注释顶部的 _pinpadNumber = [_pinpadNumber 行,它会打印适当的值。当我取消注释该行时,它只在第一次工作,并在触摸第二个按钮时崩溃。
我已经为此苦苦挣扎了两天多。我真的希望有人可以对此有所了解。