當應用程序進入警報狀態並按下背景圖像時,出現以下錯誤消息。當我點擊背景時,爲什麼我的應用會崩潰?
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
通常這個屏幕沒有錯誤,它發生在我爲應用程序設置了一個報警狀態之後。應用程序使用此方法關閉故事板中某些視圖的鍵盤。
-(void)dismissKeyboard {
[message resignFirstResponder];
[contact1 resignFirstResponder];
[contact2 resignFirstResponder];
[contact3 resignFirstResponder];
}
的您顯示的代碼與您收到的崩潰無關。異常告訴你'resignFirstResponder'消息被髮送到'NSCFString'的實例 - 我的猜測是你已經爲你的背景圖像分配了一個字符串,而不是字符串中的UIImage或類似的東西。你應該在你設置背景的地方顯示代碼 – Paulw11 2015-04-04 06:08:00
你已經走了'[self.myTextView resignFirstResponder];'還是你走了'[self.myTextView.text resignFirstResponder];'? Tab可能失敗? :P – Zhang 2015-04-04 13:22:25
@張我沒有放在那裏辭職。也許我應該? – 2015-04-04 13:24:18