iOS: Sometimes app is terminated - ios

My developing iOS application is sometimes terminated after the method addSubview: is called in the application delegate (but I'm not sure removeFromSuperview: also involved):
[self.tabBarController.view removeFromSuperview];
[self.window addSubview:navigationController.view];
What that showed in the log is:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x019b75a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01c41313 objc_exception_throw + 44
2 CoreFoundation 0x019ad0a5 -[__NSArrayM objectAtIndex:] + 261
3 <app_name> 0x000186dd -[TableViewController tableView:numberOfRowsInSection:] + 205
4 UIKit 0x00a742b7 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1834
5 UIKit 0x00a71eb1 -[UITableViewRowData numberOfRowsInSection:] + 110
6 UIKit 0x00b60807 -[UISearchDisplayController _updateNoSearchResultsMessageVisiblity] + 115
7 Foundation 0x01029669 _nsnote_callback + 145
8 CoreFoundation 0x0198f9f9 __CFXNotificationPost_old + 745
9 CoreFoundation 0x0190e93a _CFXNotificationPostNotification + 186
10 Foundation 0x0101f20e -[NSNotificationCenter postNotificationName:object:userInfo:] + 134
11 UIKit 0x008df649 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 4581
12 UIKit 0x008d9254 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
13 UIKit 0x008db38f -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 794
14 UIKit 0x008d9081 -[UIWindow setDelegate:] + 252
15 UIKit 0x00964dee -[UIViewController _tryBecomeRootViewControllerInWindow:] + 106
16 UIKit 0x00975340 -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:] + 72
17 UIKit 0x008f0e4b -[UIView(Internal) _didMoveFromWindow:toWindow:] + 918
18 UIKit 0x008efa60 -[UIView(Hierarchy) _postMovedFromSuperview:] + 166
19 UIKit 0x008e8750 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1080
20 UIKit 0x008e6aa3 -[UIView(Hierarchy) addSubview:] + 57
21 <app_name> 0x00004971 -[AppDelegate requestFinished:] + 993
22 <app_name> 0x0003e65b -[ASIHTTPRequest reportFinished] + 171
23 Foundation 0x0103e94e __NSThreadPerformPerform + 251
24 CoreFoundation 0x019988ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
25 CoreFoundation 0x018f688b __CFRunLoopDoSources0 + 571
26 CoreFoundation 0x018f5d86 __CFRunLoopRun + 470
27 CoreFoundation 0x018f5840 CFRunLoopRunSpecific + 208
28 CoreFoundation 0x018f5761 CFRunLoopRunInMode + 97
29 GraphicsServices 0x01db11c4 GSEventRunModal + 217
30 GraphicsServices 0x01db1289 GSEventRun + 115
31 UIKit 0x008c5c93 UIApplicationMain + 1160
32 <app_name> 0x00002a30 main + 192
33 <app_name> 0x00002255 start + 53
)
terminate called throwing an exception
How can I find out the reason why the app is terminated by this log and solve it? Thank you.
Note: Edit 1 and Edit 2 were removed.
Edit 3: This implemented code of tableView:numberOfRowsInSection: method works for me:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.searchDisplayController.searchResultsTableView)
{
if (filteredSectionListOfAddressBook && filteredSectionListOfAddressBook.count)
{
return [[filteredSectionListOfAddressBook objectAtIndex:section] count];
}
else
{
return 0;
}
}
else if (tableView == self.tableView)
{
if (sectionListOfAddressBook && sectionListOfAddressBook.count)
{
return [[sectionListOfAddressBook objectAtIndex:section] count];
}
else
{
return 0;
}
}
return 0;
}

In your stack trace - there is a tableview - you need to ensure that there is data to populate the table. Thats where this error is coming from
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array
You could for the moment ensure there is no data by making sure that
tableView:numberOfRowsInSection: returns 0;
Have you implemented the TableViews delegate methods?
Read about it here About Table Views in iOS-Based Applications
here UITableViewDataSource Protocol Reference
and here UITableViewDelegate Protocol Reference

I just ran into a problem like this in my code, and I found that it was caused by the search delegate holding on to the search bar and the table ref. If a set these properties to nil in searchDisplayControllerDidEndSearch then it got rid of the problem. It was likely caused by a circular ref loop. The stack trace looked like so:
[__NSArrayM _updateNoSearchResultsMessageVisiblity]: unrecognized selector sent to instance 0x21c350
#0 0x3369a1c8 in objc_exception_throw ()
#1 0x338b5aca in -[NSObject doesNotRecognizeSelector:] ()
#2 0x338b4944 in __forwarding__ ()
#3 0x3380f680 in _forwarding_prep_0__ ()
#4 0x30e5aff8 in -[UISearchResultsTableView _numberOfRowsDidChange] ()
#5 0x30d6c3b2 in -[UITableView noteNumberOfRowsChanged] ()
#6 0x30d6bf4e in -[UITableView reloadData] ()

Related

Webview.Scrollview - Unable to add more than 126 Objects

My Application is getting crashed while scrolling UIWebview - I have used ILPDFKit for implementing interactive PDF - Editable Forms.App is getting crashed only if i am adding more than 126 Objects.
Here is code I am using (from ILPDFKit)
for (PDFWidgetAnnotationView *element in widgetAnnotationViews)
{
element.alpha = 0;
element.parentView = self;
[_pdfView.scrollView addSubview:element];
[_pdfView.scrollView bringSubviewToFront:element];
if ([element isKindOfClass:[PDFFormButtonField class]])
{
[(PDFFormButtonField*)element setButtonSuperview];
}
}
I have also raise Issue here
I have added some customview's in my webview.scrollview , so while scrolling webview my App is getting crashed. i have checked for all possible solutions i found on google/stackoverflow.
none of the delegate method of scrollview / webview called before this crash , as soon as i tried to scroll and app is getting crashed.
below is crash report.
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x6000024535f0> was mutated while being enumerated.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001045dd34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000103f5f21e objc_exception_throw + 48
2 CoreFoundation 0x0000000104645f1c __NSFastEnumerationMutationHandler + 124
3 CoreFoundation 0x0000000104582638 -[NSArray makeObjectsPerformSelector:] + 424
4 UIKit 0x00000001020d8f4f -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 163
5 UIKit 0x00000001020c3919 -[UIScrollView setContentOffset:] + 478
6 UIKit 0x00000001020c8351 -[UIScrollView _updatePanGesture] + 2346
7 UIKit 0x0000000102531289 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
8 UIKit 0x0000000102539028 _UIGestureRecognizerSendTargetActions + 109
9 UIKit 0x0000000102536af7 _UIGestureRecognizerSendActions + 227
10 UIKit 0x0000000102535d83 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 891
11 UIKit 0x0000000102521e56 _UIGestureEnvironmentUpdate + 1395
12 UIKit 0x000000010252189b -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 521
13 UIKit 0x0000000102520a7e -[UIGestureEnvironment _updateGesturesForEvent:window:] + 286
14 UIKit 0x000000010205f7ad -[UIWindow sendEvent:] + 3989
15 UIKit 0x000000010200ca33 -[UIApplication sendEvent:] + 371
16 UIKit 0x00000001027feb6d __dispatchPreprocessedEventFromEventQueue + 3248
17 UIKit 0x00000001027f7817 __handleEventQueue + 4879
18 CoreFoundation 0x0000000104582311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x000000010456759c __CFRunLoopDoSources0 + 556
20 CoreFoundation 0x0000000104566a86 __CFRunLoopRun + 918
21 CoreFoundation 0x0000000104566494 CFRunLoopRunSpecific + 420
22 GraphicsServices 0x0000000107910a6f GSEventRunModal + 161
23 UIKit 0x0000000101feef34 UIApplicationMain + 159
24 HyundaiCapital 0x000000010132a67f main + 111
25 libdyld.dylib 0x000000010610268d start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Edit
1.How many subviews at most i can add into delegate of scrollview at a time?
2.I am only getting this crash if i am adding subviews more than 126?
Solution
Updating ILPDFKit worked for me.

segmented control - unrecognized selector sent to instance

I want to use sender to get the value from segmented control, but I am getting the unrecognized selector sent to instance error. The segmented control was added within a view. I've tried removing the semicolon and/or sender and none of the prior posts I've found seem to help. Any ideas?
Swift Code
var segCntrl = UISegmentedControl(items: ["Yes","No"])
segCntrl.tag = 100
segCntrl.center = CGPointMake(qView.bounds.width/2, qView.bounds.minY+40)
self.qView.addSubview(segCntrl)
func segmentorSwitch(sender: AnyObject) {
if(sender.selectedSegmentIndex == 1) {
println("Yes selected")
}
else if(sender.selectedSegmentIndex == 2) {
println("No selected")
}
}
segCntrl.addTarget(self, action: "segmentorSwitch:", forControlEvents: UIControlEvents.ValueChanged)
Error code:
2015-07-07 11:46:24.482 myApp [75641:1855377] -[[myApp.SegViewControllerr segmentorSwitch:]: unrecognized selector sent to instance 0x7fbb0a43b450
2015-07-07 11:46:24.489 myApp[75641:1855377] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myApp.SegViewController segmentorSwitch:]: unrecognized selector sent to instance 0x7fbb0a43b450'
* First throw call stack:
(
0 CoreFoundation 0x00000001060dcc65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010838abb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001060e40ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010603a13c ___forwarding_ + 988
4 CoreFoundation 0x0000000106039cd8 _CF_forwarding_prep_0 + 120
5 UIKit 0x00000001070bfd62 -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x00000001071d150a -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x000000010724dfba -[UISegmentedControl _setSelectedSegmentIndex:notify:animate:] + 570
8 UIKit 0x000000010724ffbf -[UISegmentedControl touchesEnded:withEvent:] + 143
9 UIKit 0x000000010710c958 -[UIWindow _sendTouchesForEvent:] + 735
10 UIKit 0x000000010710d282 -[UIWindow sendEvent:] + 682
11 UIKit 0x00000001070d3541 -[UIApplication sendEvent:] + 246
12 UIKit 0x00000001070e0cdc _UIApplicationHandleEventFromQueueEvent + 18265
13 UIKit 0x00000001070bb59c _UIApplicationHandleEventQueue + 2066
14 CoreFoundation 0x0000000106010431 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
15 CoreFoundation 0x00000001060062fd __CFRunLoopDoSources0 + 269
16 CoreFoundation 0x0000000106005934 __CFRunLoopRun + 868
17 CoreFoundation 0x0000000106005366 CFRunLoopRunSpecific + 470
18 GraphicsServices 0x000000010cc5ba3e GSEventRunModal + 161
19 UIKit 0x00000001070be8c0 UIApplicationMain + 1282
20 myApp 0x0000000104d9a0c7 main + 135
21 libdyld.dylib 0x0000000109458145 start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Looks like segmentorSwitch: is implemented inside another method. Define it outside the method in which your code is contained, and this should be fixed.

Need help interpreting a crash log from QuincyKit

I recently added QuincyKit (a crash log reporter that sits on top of PLCrashReporter) into an app and I received a crash log that I'm having trouble interpreting.
The crash log seems to be inconsistent - it says it was thread 0 that crashed, but the "Last Exception Backtrace" doesn't match with the thread 0 callstack. The last exception points to a table method, but thread 0 callstack indicates an abort occurred during the Quincy manager initialization.
Moreover, the "Last Exception Backtrace" doesn't seem to make much sense taken on it's own - the "canEditRowAtIndexPath" method doesn't even include a call to "removeObjectAtIndex" at all (see below for the method).
Can anyone shed any light onto whether or not I should be paying attention to the "Last Exception Backtrace" or is that a red herring, and I should really be looking into why PLCrashReporter aborted during start up?
Many thanks
Crash log excerpt:
Exception Type: SIGABRT
Exception Codes: #0 at 0x38362df0
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 7 beyond bounds [0 .. 6]'
Last Exception Backtrace:
0 CoreFoundation 0x29920fef <redacted> + 126
1 libobjc.A.dylib 0x37d0cc8b objc_exception_throw + 38
2 CoreFoundation 0x29833821 -[__NSArrayM removeObjectAtIndex:] + 0
3 DART 0x000906b3 -[DeliveryComplete tableView:canEditRowAtIndexPath:] + 262
4 UIKit 0x2d0a3c25 -[UITableView _canEditRowAtIndexPath:] + 60
5 UIKit 0x2d0a3a7f -[UITableView _setupCell:forEditing:atIndexPath:animated:updateSeparators:] + 130
6 UIKit 0x2d0a1179 <redacted> + 2320
7 UIKit 0x2cf82a31 +[UIView performWithoutAnimation:] + 72
8 UIKit 0x2d0a0861 -[UITableView _configureCellForDisplay:forIndexPath:] + 336
9 UIKit 0x2d246383 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 498
10 UIKit 0x2d24642f -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 54
11 UIKit 0x2d23b013 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2258
12 UIKit 0x2d049657 -[UITableView layoutSubviews] + 186
13 UIKit 0x2cf73023 -[UIView layoutSublayersOfLayer:] + 546
14 QuartzCore 0x2c993d99 -[CALayer layoutSublayers] + 128
15 QuartzCore 0x2c98f5cd <redacted> + 360
16 QuartzCore 0x2c98f455 <redacted> + 16
17 QuartzCore 0x2c98edf1 <redacted> + 224
18 QuartzCore 0x2c98ebdf <redacted> + 434
19 UIKit 0x2cf6b23b <redacted> + 126
20 CoreFoundation 0x298e6fed <redacted> + 20
21 CoreFoundation 0x298e46ab <redacted> + 278
22 CoreFoundation 0x298e4ab3 <redacted> + 914
23 CoreFoundation 0x29831201 CFRunLoopRunSpecific + 476
24 CoreFoundation 0x29831013 CFRunLoopRunInMode + 106
25 GraphicsServices 0x3100d201 GSEventRunModal + 136
26 UIKit 0x2cfd5a59 UIApplicationMain + 1440
27 DART 0x00015491 _mh_execute_header + 25745
28 libdyld.dylib 0x38298aaf <redacted> + 2
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x38362df0 __pthread_kill + 8
1 libsystem_c.dylib 0x382fe909 abort + 76
2 DART 0x00122dd7 -[PLCrashReporter enableCrashReporterAndReturnError:] + 1294
3 CoreFoundation 0x2992131f <redacted> + 630
4 libobjc.A.dylib 0x37d0cf13 <redacted> + 174
5 libc++abi.dylib 0x37643de3 <redacted> + 78
6 libc++abi.dylib 0x376438af __cxa_rethrow + 102
7 libobjc.A.dylib 0x37d0cdd3 objc_exception_rethrow + 42
8 CoreFoundation 0x2983129d CFRunLoopRunSpecific + 632
9 CoreFoundation 0x29831013 CFRunLoopRunInMode + 106
10 GraphicsServices 0x3100d201 GSEventRunModal + 136
11 UIKit 0x2cfd5a59 UIApplicationMain + 1440
12 DART 0x00015491 _mh_execute_header + 25745
13 libdyld.dylib 0x38298aaf <redacted> + 2
"canEditRowAtIndexPath" method:
-(BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView.tag == SIGNER_TABLE_TAG_VALUE)
{
RouteStopData *currentStop = [CurrentRoute singleton].selectedStop;
NSArray *signers = [currentStop signerNamesForStop];
if (indexPath.row >= [signers count])
{
return NO;
}
if ([[signers objectAtIndex:indexPath.row] isEqualToString:DARK_DROP_SIGNER_STRING] ||
[[signers objectAtIndex:indexPath.row] isEqualToString:PAPER_INVOICE_SIGNER_STRING] ||
[[signers objectAtIndex:indexPath.row] isEqualToString:ADD_NEW_SIGNER_STRING]
)
{
return NO;
}
return YES;
}
return NO;
}
If you are using ios7, it's maybe UIKit's fault.
Tableview would like to call delegate method before dealloc.
So you can add this code in your Custom class:
- (void )dealloc{
self.tableView.dataSource = nil;
self.tableView.delegate = nil;
}
See more in iOS 7 bug or my bug in UIAlertView

Localized App crashes with NSRangeException

I have an iOS app that has been working quite well in two languages – I know added some stuff, already keeping in mind using NSLocalizedString for localization etc. The english version of the app works fine so far, but the second language version crashes right after starting. Why?
One should note that I have not added all NSLocalizedStrings in my localizable.strings file. Furthermore, I have two separate Storyboards for both english an german. Any help would be greatly appreciated!
2014-12-18 18:14:36.083 Coverdale[48297:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x002461e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x020538e5 objc_exception_throw + 44
2 CoreFoundation 0x001fa8b2 -[__NSArrayI objectAtIndex:] + 210
3 UIKit 0x0126a35f -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 127
4 UIKit 0x00fe3f34 -[UITableViewController tableView:indentationLevelForRowAtIndexPath:] + 61
5 UIKit 0x00e012cf __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1786
6 UIKit 0x00d7581f +[UIView(Animation) performWithoutAnimation:] + 82
7 UIKit 0x00d75868 +[UIView(Animation) _performWithoutAnimation:] + 40
8 UIKit 0x00e00bd0 -[UITableView _configureCellForDisplay:forIndexPath:] + 108
9 UIKit 0x00e0813d -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 442
10 UIKit 0x00e081f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
11 UIKit 0x00de9ece -[UITableView _updateVisibleCellsNow:] + 2428
12 UIKit 0x00dfe6a5 -[UITableView layoutSubviews] + 213
13 UIKit 0x00d7e964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
14 libobjc.A.dylib 0x0206582b -[NSObject performSelector:withObject:] + 70
15 QuartzCore 0x007c845a -[CALayer layoutSublayers] + 148
16 QuartzCore 0x007bc244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17 QuartzCore 0x007bc0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18 QuartzCore 0x007227fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
19 QuartzCore 0x00723b85 _ZN2CA11Transaction6commitEv + 393
20 QuartzCore 0x00724258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
21 CoreFoundation 0x0020e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
22 CoreFoundation 0x0020e2bf __CFRunLoopDoObservers + 399
23 CoreFoundation 0x001ec254 __CFRunLoopRun + 1076
24 CoreFoundation 0x001eb9d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x001eb7eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x0406b5ee GSEventRunModal + 192
27 GraphicsServices 0x0406b42b GSEventRun + 104
28 UIKit 0x00d0ff9b UIApplicationMain + 1225
29 Coverdale 0x0009b95d main + 141
30 libdyld.dylib 0x028b9701 start + 1
31 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
EDIT
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = #"Error";
if (indexPath.section == 0) {
if(indexPath.row == 0)
{ /*..*/}
}
return cell;
}
Turns out I needed to implement indentationLevelForRowAtIndexPath and just return 0.

Invalid update: invalid number of rows in section 0

i have problem when i try delete or add object a the list
errror:
2014-09-04 10:59:03.815 DeleteListTest[2781:60b] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:1368
2014-09-04 10:59:03.856 DeleteListTest[2781:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (9) must be equal to the number of rows contained in that section before the update (10), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(
0 CoreFoundation 0x01b581e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018d78e5 objc_exception_throw + 44
2 CoreFoundation 0x01b58048 +[NSException raise:format:arguments:] + 136
3 Foundation 0x014b74de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0066ff63 -[UITableView _endCellAnimationsWithContext:] + 13402
5 UIKit 0x0067fcea -[UITableView endUpdatesWithContext:] + 51
6 UIKit 0x0067fd18 -[UITableView endUpdates] + 41
7 DeleteListTest 0x00002ece -[MasterViewController leaveEditMode] + 270
8 DeleteListTest 0x0000301a -[MasterViewController tableView:commitEditingStyle:forRowAtIndexPath:] + 202
9 UIKit 0x006916a3 -[UITableView animateDeletionOfRowWithCell:] + 107
10 UIKit 0x0081a595 -[UITableViewCell _swipeDeleteButtonPushed] + 70
11 libobjc.A.dylib 0x018e9880 -[NSObject performSelector:withObject:withObject:] + 77
12 UIKit 0x005993b9 -[UIApplication sendAction:to:from:forEvent:] + 108
13 UIKit 0x00599345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
14 UIKit 0x0069abd1 -[UIControl sendAction:to:forEvent:] + 66
15 UIKit 0x0069afc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
16 UIKit 0x0069a243 -[UIControl touchesEnded:withEvent:] + 641
17 UIKit 0x0092f2e3 _UIGestureRecognizerUpdate + 7166
18 UIKit 0x005d8a5a -[UIWindow _sendGesturesForEvent:] + 1291
19 UIKit 0x005d9971 -[UIWindow sendEvent:] + 1021
20 UIKit 0x005ab5f2 -[UIApplication sendEvent:] + 242
21 UIKit 0x00595353 _UIApplicationHandleEventQueue + 11455
22 CoreFoundation 0x01ae177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
23 CoreFoundation 0x01ae110b __CFRunLoopDoSources0 + 235
24 CoreFoundation 0x01afe1ae __CFRunLoopRun + 910
25 CoreFoundation 0x01afd9d3 CFRunLoopRunSpecific + 467
26 CoreFoundation 0x01afd7eb CFRunLoopRunInMode + 123
27 GraphicsServices 0x03a0a5ee GSEventRunModal + 192
28 GraphicsServices 0x03a0a42b GSEventRun + 104
29 UIKit 0x00597f9b UIApplicationMain + 1225
30 DeleteListTest 0x00004a4d main + 141
31 libdyld.dylib 0x0219f701 start + 1
32 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
this is the delete method
if(editingStyle == UITableViewCellEditingStyleDelete){
[tableTitles removeObjectAtIndex:[indexPath row]];
[self leaveEditMode];
[[self tableView] reloadData];
someone can help me ? thx u :)
I believe you are missing the call to:
[self.tableView deleteRowsAtIndexPaths:indexPath
withRowAnimation:UITableViewRowAnimationFade];
and you don't need the reloadData call:
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableTitles removeObjectAtIndex:[indexPath row]];
[self.tableView deleteRowsAtIndexPaths:#[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self leaveEditMode];
(this will also look better as it will give visual feedback to the user; unlike reloadData).

Resources