为什么我的应用程序在我点击背景时崩溃?
Why does my app crash when I tap the background?
当应用程序进入警报状态并且我按下背景图片时,我收到以下错误消息。
2015-04-04 01:06:39.583 APP[479:44057] -[__NSCFString resignFirstResponder]: unrecognized selector sent to instance 0x16d627c0
2015-04-04 01:06:39.584 APP[479:44057] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString resignFirstResponder]: unrecognized selector sent to instance 0x16d627c0'
*** First throw call stack:
(0x270e35a7 0x34cc9c77 0x270e8a6d 0x270e6949 0x27017b68 0x4ed91 0x2a76507f 0x2a6139ed 0x2aa29951 0x2a5dd3c5 0x2a5db33f 0x2a611ddd 0x2a6116ad 0x2a5e7fbd 0x2a85bbb5 0x2a5e6a07 0x270aa237 0x270a964b 0x270a7cc9 0x26ff4b51 0x26ff4963 0x2e5331a9 0x2a646c91 0x4ca35 0x35272aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
一般情况下这个画面是没有错误的,是我给app设置了闹钟状态后出现的。该应用使用此方法关闭情节提要中某些视图上的键盘。
-(void)dismissKeyboard {
[message resignFirstResponder];
[contact1 resignFirstResponder];
[contact2 resignFirstResponder];
[contact3 resignFirstResponder];
}
从与杰克的聊天来看,崩溃的罪魁祸首似乎是由于一种方法:
-(void)dismissKeyboard
{
// ------------------------------------------------------
// These variables appear to be NSString, so it crashes
// ------------------------------------------------------
[message resignFirstResponder];
[contact1 resignFirstResponder];
[contact2 resignFirstResponder];
[contact3 resignFirstResponder];
}
所以解决方案是简单地将其更改为:
-(void)dismissKeyboard
{
[self.view endEditing:YES];
}
当应用程序进入警报状态并且我按下背景图片时,我收到以下错误消息。
2015-04-04 01:06:39.583 APP[479:44057] -[__NSCFString resignFirstResponder]: unrecognized selector sent to instance 0x16d627c0
2015-04-04 01:06:39.584 APP[479:44057] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString resignFirstResponder]: unrecognized selector sent to instance 0x16d627c0'
*** First throw call stack:
(0x270e35a7 0x34cc9c77 0x270e8a6d 0x270e6949 0x27017b68 0x4ed91 0x2a76507f 0x2a6139ed 0x2aa29951 0x2a5dd3c5 0x2a5db33f 0x2a611ddd 0x2a6116ad 0x2a5e7fbd 0x2a85bbb5 0x2a5e6a07 0x270aa237 0x270a964b 0x270a7cc9 0x26ff4b51 0x26ff4963 0x2e5331a9 0x2a646c91 0x4ca35 0x35272aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
一般情况下这个画面是没有错误的,是我给app设置了闹钟状态后出现的。该应用使用此方法关闭情节提要中某些视图上的键盘。
-(void)dismissKeyboard {
[message resignFirstResponder];
[contact1 resignFirstResponder];
[contact2 resignFirstResponder];
[contact3 resignFirstResponder];
}
从与杰克的聊天来看,崩溃的罪魁祸首似乎是由于一种方法:
-(void)dismissKeyboard
{
// ------------------------------------------------------
// These variables appear to be NSString, so it crashes
// ------------------------------------------------------
[message resignFirstResponder];
[contact1 resignFirstResponder];
[contact2 resignFirstResponder];
[contact3 resignFirstResponder];
}
所以解决方案是简单地将其更改为:
-(void)dismissKeyboard
{
[self.view endEditing:YES];
}