2015-02-03 22 views
-2

replaceobjectatindex에서 응용 프로그램이 충돌합니다. clickedbuttonpath.row는 nil 값을 반환합니다. 도움이 필요하다 .응용 프로그램이 replaceobjectatindex에서 충돌합니다.

- (void)textFieldDidEndEditing:(UITextField *)textField 
{ 
if (textField.text.length>0) 
{ 
UITableViewCell *clickedCell = (UITableViewCell *)[[textField superview] superview]; 
NSIndexPath *clickedButtonPath = [addSizesTableView_ indexPathForCell:clickedCell]; 
if (textField.tag==6) 
{ 
[textDic setObject:textField.text forKey:clickedButtonPath]; 
[orderArr replaceObjectAtIndex:clickedButtonPath.row withObject:textField.text]; 

이 은 무엇입니까 충돌 로그입니다.

'NSInvalidArgumentException'이유 '* setObjectForKey : 키 전무 수 없습니다' ( 0 CoreFoundation에서 0x0000000106d1ef35 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001062acbb7 objc_exception_throw + 45 * 우선 투사 호출 스택 2 CoreFoundation에서 0x0000000106c25998 - [__ NSDictionaryM의 setObject : forKey :] + 968 3 BookMyStock의 0x0000000103559ac0 - [AddSizesOfColors의 textFieldDidEndEditing :] + 368 UIKit 0x0000000105289549 4 - [UITextField에 _resignFirstResponder] + 382 5 UIKit의 0x0000000104ccc4f 5 - [UIResponder resignFirstResponder] + 236 6 UIKit 0x00000001052892d4 - [UITextField에 resignFirstResponder] + 114 7 UIKit 0x0000000105295953 - [UIView의 (의 UITextField) endEditing :] + 173 8 BookMyStock 0x0000000103557c2d - [AddSizesOfColors addTFTotheView] + 285 9 UIKit의 0x0000000104b568be - [UIApplication 액션 (SendAction) : 행 : 행 : forEvent :] + 75 10 UIKit 0x0000000104c5d410 - [UIControl _sendActionsForEvents : withEvent :] + 467 11 UIKit의 0x0000000104c5c7df - [UIControl touchesEnded : withEvent :] + 522 12 UIKit 0x0000000104b9c308 - [UIWindow _sendTouchesForEvent : ] + 735 13 UIKit 0x0000000104b9cc33 - [UIWindow sendEvent :] + 683 14 UIKit 0x0000000104b699b1 - [UI 애플리케이션 sendEvent : _UIApplicationHandleEventQueue + 1961 + 246 15 UIKit 0x0000000104b76a7d _UIApplicationHandleEventFromQueueEvent + 17,370 16 UIKit 0x0000000104b52103 17 CoreFoundation에서 0x0000000106c54551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 18 CoreFoundation에서 0x0000000106c4a41d __CFRunLoopDoSources0 + 269 19 CoreFoundation에서 0x0000000106c49a54 __CFRunLoopRun + 868 20 CoreFoundation에서 0x0000000106c49486 CFRunLoopRunSpecific + 470 21 GraphicsServices 0x0000000108bdc9f0 GSEventRunModal + 161 22 UIKit 0x0000000104b55420 UIApplicationMain + 1282 23 BookMyStock 0x0000000103492913 주 + 115 24 libdyld.dylib 시작 0x0000000107c7e145 + 1)의 libc ++ abi.dylib : NSException

형 캐치되지 제외 종료
+0

RU는 checkd U 자는 –

+0

그렇지 않으면 아무도 당신을 도울 수 없습니다하는 crashlog을 게시하시기 바랍니다 수있는 인덱스 :) – nburk

+0

스택 오버플로에 오신 것을 환영합니다. 답변을받을 가능성이있는 질문을하는 방법은 도움말 센터를 참조하십시오 (http://stackoverflow.com/help/how-to-ask).특히, 문제의 더 나은 제거를 허용하는 오류 메시지를 포함하십시오. – h7r

답변

0

[수퍼에 textField]은 수퍼] 아이폰 OS 7 그것에 반해 IO에서 8 넣다 닐을 반환 어떤 값을 반환합니다. 아래 링크에서 제안 된 것처럼 뷰 계층 구조에 의존하지 마십시오.

당신은 당신은 구조처럼 아래 시도 할 수 있습니다이 링크 Getting UITableViewCell from its superview iOS 7 issue

을 확인할 수 있습니다

CGPoint subviewPosition = [textField convertPoint:CGPointZero toView:self.tableView]; 
NSIndexPath* clickedButtonPath = [addSizesTableView_ indexPathForRowAtPoint:subviewPosition]; 
+0

감사합니다. Vinoth. 귀하의 코드를 시도했지만 문제는 응용 프로그램이 충돌하는 것입니다. [orderArr replaceObjectAtIndex : clickedButtonPath.row withObject : textField.text]; – Nikilicious

+0

중단 점 또는 NSLog를 유지하고 clickedCell이 iOS 8에서 0이 아닌 값을 가져 오는 것을 볼 수 있습니까? 왜냐하면 clickedCell이 nil이면 clickedButtonPath는 nil이 될 것이고 clickedButtonPath.row는 nil이 될 것이기 때문입니다. –

+0

UITableViewCell * clickedCell = (UITableViewCell *) [[textField superview] superview]; –

관련 문제