The application crashes at replaceobjectatindex . The clickedbuttonpath.row returns nil value . Need help .
- (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];
This is the crash log which am getting .
'NSInvalidArgumentException', reason: '* setObjectForKey: key cannot be nil' * First throw call stack: ( 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 4 UIKit 0x0000000105289549 -[UITextField _resignFirstResponder] + 382 5 UIKit 0x0000000104ccc4f5 -[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:to:from: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 -[UIApplication sendEvent:] + 246 15 UIKit 0x0000000104b76a7d _UIApplicationHandleEventFromQueueEvent + 17370 16 UIKit 0x0000000104b52103 _UIApplicationHandleEventQueue + 1961 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 main + 115 24 libdyld.dylib 0x0000000107c7e145 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException