CellForRowAtIndexPath crashing on curly braces - swift

I am using a table view in my project, the crashlytics reports are showing a crash in my cellForRowAtIndexPath function on the curly braces exactly which is not helping me to find the bug. I am not being able to reproduce this bug either on my device nor on the simulators. The stack trace is below and the cellForRowAtIndexPath code is attached as an image.
Code
Crashlytics Stack-trace
Crashed: com.apple.main-thread
0 Synkers 0x104407d20 specialized HomeScreenViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (HomeScreenViewController.swift:208)
1 Synkers 0x104404134 #objc HomeScreenViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (HomeScreenViewController.swift)
2 UIKit 0x18a421474 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
3 UIKit 0x18a4219d8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
4 UIKit 0x18a401670 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2140
5 UIKit 0x18a1bcf10 -[UITableView layoutSubviews] + 140
6 UIKit 0x18a0e9000 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1256
7 QuartzCore 0x184cb90b4 -[CALayer layoutSublayers] + 184
8 QuartzCore 0x184cbd194 CA::Layer::layout_if_needed(CA::Transaction*) + 332
9 QuartzCore 0x184c2bf24 CA::Context::commit_transaction(CA::Transaction*) + 336
10 QuartzCore 0x184c52340 CA::Transaction::commit() + 540
11 UIKit 0x18a0de884 _afterCACommitHandler + 256
12 CoreFoundation 0x180c838b8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
13 CoreFoundation 0x180c81270 __CFRunLoopDoObservers + 412
14 CoreFoundation 0x180c8182c __CFRunLoopRun + 1292
15 CoreFoundation 0x180ba22d8 CFRunLoopRunSpecific + 436
16 GraphicsServices 0x182a33f84 GSEventRunModal + 100
17 UIKit 0x18a14f880 UIApplicationMain + 208
18 Synkers 0x104215ba4 main (main.m:14)
19 libdyld.dylib 0x1806c656c start + 4

This has nothing todo with the error, but since my reputation is too low, i'll have to write an answere:
Never force-uncast a cell!
...forIndexPath: indexPath) as! ...
This may cause errors and even crashes

Related

unrecognized selector sent to instance when no related entities found in Core Data

I have a Core Data problem - I have two entity's with the second being a one to many relation ship to the first. When trying to load a detailed view controller on the first with the first one's information and a UITableView fo the details of the 2nd, I am hoping this tableView code would allow me to show a blank table if now records are found. Instead I get a crash as indicated above. I have tried to cover the "Event" (the related NSSet) into an array, but I am not sure how to debug this error. Thanks for any pointers!
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "eventCell", for: indexPath)
let eventsOnArray = selectedRecipient?.events.allObjects
let event = eventsOnArray![indexPath.row] as! Event
if selectedRecipient?.events.count != nil {
cell.textLabel?.text = event.event
}
return cell
}
Adding detailed Stack Trace -
2018-03-03 10:27:29.419115-0500 Card Tracker[5162:453078] -[Recipient events]: unrecognized selector sent to instance 0x60000009cbb0
2018-03-03 10:27:29.427781-0500 Card Tracker[5162:453078] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Recipient events]: unrecognized selector sent to instance 0x60000009cbb0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107fd212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000103d79f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000108053024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000107f54f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000107f54958 _CF_forwarding_prep_0 + 120
5 Card Tracker 0x0000000103434fca _T012Card_Tracker010ViewEventsC10ControllerC05tableC0SiSo07UITableC0C_Si21numberOfRowsInSectiontF + 410
6 Card Tracker 0x00000001034352e4 _T012Card_Tracker010ViewEventsC10ControllerC05tableC0SiSo07UITableC0C_Si21numberOfRowsInSectiontFTo + 68
7 UIKit 0x0000000104cd1b4c -[UITableView _numberOfRowsInSection:] + 62
8 UIKit 0x0000000104f840e1 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2389
9 UIKit 0x0000000104f8a5ab -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 487
10 UIKit 0x0000000104f8a711 -[UITableViewRowData heightForTable] + 61
11 UIKit 0x0000000104c7fa65 -[UITableView _updateContentSize] + 372
12 UIKit 0x0000000104cb067d -[UITableView _rebuildGeometry] + 66
13 UIKit 0x0000000104cae03c -[UITableView didMoveToWindow] + 145
14 UIKit 0x0000000104c2b147 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748
15 UIKit 0x0000000104c44a81 -[UIScrollView _didMoveFromWindow:toWindow:] + 84
16 UIKit 0x0000000104c2ad84 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785
17 UIKit 0x0000000104c1d1e1 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
18 UIKit 0x0000000104c1d0c8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 828
19 UIKit 0x0000000104c2dcbd -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
20 UIKit 0x0000000104b504e7 -[_UIParallaxDimmingView didMoveToWindow] + 179
21 UIKit 0x0000000104c2b147 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748
22 UIKit 0x0000000104c2ad84 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785
23 UIKit 0x0000000104c1d1e1 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
24 UIKit 0x0000000104c1d0c8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 828
25 UIKit 0x0000000104c2dcbd -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
26 UIKit 0x0000000104b4b259 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 2305
27 UIKit 0x0000000104c25c60 +[UIView(Animation) performWithoutAnimation:] + 90
28 UIKit 0x0000000104b4a903 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 260
29 UIKit 0x0000000104c2c271 +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 188
30 UIKit 0x0000000104b4a21b -[_UINavigationParallaxTransition animateTransition:] + 1270
31 UIKit 0x0000000104d3e3ee -[UINavigationController _startCustomTransition:] + 3678
32 UIKit 0x0000000104d543b4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 686
33 UIKit 0x0000000104d556d3 -[UINavigationController __viewWillLayoutSubviews] + 150
34 UIKit 0x0000000104fb04e2 -[UILayoutContainerView layoutSubviews] + 231
35 UIKit 0x0000000121187008 -[UILayoutContainerViewAccessibility layoutSubviews] + 42
36 UIKit 0x0000000104c34a6d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1439
37 QuartzCore 0x000000010b5d361c -[CALayer layoutSublayers] + 159
38 QuartzCore 0x000000010b5d77ad _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
39 QuartzCore 0x000000010b55e86c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 364
40 QuartzCore 0x000000010b58b946 _ZN2CA11Transaction6commitEv + 500
41 UIKit 0x0000000104b8d167 _afterCACommitHandler + 272
42 CoreFoundation 0x0000000107f74c07 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
43 CoreFoundation 0x0000000107f74b5e __CFRunLoopDoObservers + 430
44 CoreFoundation 0x0000000107f59124 __CFRunLoopRun + 1572
45 CoreFoundation 0x0000000107f58889 CFRunLoopRunSpecific + 409
46 GraphicsServices 0x000000010a77b9c6 GSEventRunModal + 62
47 UIKit 0x0000000104b635d6 UIApplicationMain + 159
48 Card Tracker 0x0000000103417ea7 main + 55
49 libdyld.dylib 0x0000000109170d81 start + 1
50 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Two problems uncovered. one in the data model the secondary entity is called card not events. And two as pointed out by #vadian above should do the load in the viewDidLoad. Thanks

Why app crashes with [NSObject(NSObject) doesNotRecognizeSelector:]?

The app sometimes crashes with [NSObject(NSObject) doesNotRecognizeSelector:], the selector being [UIImageView setImage:].
I captured it by setting an exception breakpoint and the crash happens when setting an UIImageView.image in prepareForReuse of a UICollectionViewCell:
class MyCell: UICollectionViewCell {
var coverImageView = UIImageView()
...
override func prepareForReuse() {
super.prepareForReuse()
coverImageView.image = nil
}
}
The prepareForReuse is called then the cell is instantiated:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = myCollectionView.dequeueReusableCell(withReuseIdentifier: "myReuseID", for: indexPath) as! MyCell
...
}
Why is that happening?
Also I cannot load the quick look data view for the UIImageView so maybe the object has been released?
The error messages in console are:
2017-01-21 15:56:19.653 MyApp[4873:20387361] -[__NSMallocBlock__ size]: unrecognized selector sent to instance 0x608000880aa0
2017-01-21 15:56:37.697 MyApp[4873:20387361] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
2017-01-21 15:56:38.847 MyApp[4873:20617657] [Optimizely Logging]: Successfully saved data file to disk. Code revision is 229
2017-01-21 15:56:42.723 MyApp[4873:20387361] [Optimizely Logging]: (ERROR) NSInvalidArgumentException: Stack Trace:
(
0 CoreFoundation 0x000000010f587d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ef6121e objc_exception_throw + 48
2 CoreFoundation 0x000000010f5f7f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010f50d005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010f50cb88 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010ba5e20f -[UIImageView _updateImageViewForOldImage:newImage:] + 297
6 UIKit 0x000000010ba59950 -[UIImageView setImage:] + 391
7 MyApp 0x000000010945e0d8 _TFC6MyApp23MyCell15prepareForReusefT_T_ + 136
8 MyApp 0x000000010945e112 _TToFC6MyApp23MyCell15prepareForReusefT_T_ + 34
9 UIKit 0x000000010c19aed1 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 773
10 UIKit 0x000000010c19b8ea -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
11 MyApp 0x00000001095bdee2 _TFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 594
12 MyApp 0x00000001095be747 _TToFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 87
13 UIKit 0x000000010c18675f -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 467
14 UIKit 0x000000010c186586 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
15 UIKit 0x000000010c18ba5e -[UICollectionView _updateVisibleCellsNow:] + 4803
16 UIKit 0x000000010c191725 -[UICollectionView layoutSubviews] + 313
17 UIKit 0x000000010b90dab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x000000010d558bf8 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000010d54c440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000010d54c2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x000000010d4da318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x000000010d5073ff _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x000000010d507d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000010f52c267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000010f52c1d7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010f510f8e __CFRunLoopRun + 1198
27 CoreFoundation 0x000000010f510884 CFRunLoopRunSpecific + 420
28 GraphicsServices 0x0000000112b77a6f GSEventRunModal + 161
29 UIKit 0x000000010b848c68 UIApplicationMain + 159
30 MyApp 0x00000001092f5a7f main + 111
31 libdyld.dylib 0x00000001115b568d start + 1
)
2017-01-21 15:56:42.725 MyApp[4873:20387361] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSMallocBlock__ size]: unrecognized selector sent to instance 0x608000880aa0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f587d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ef6121e objc_exception_throw + 48
2 CoreFoundation 0x000000010f5f7f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010f50d005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010f50cb88 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010ba5e20f -[UIImageView _updateImageViewForOldImage:newImage:] + 297
6 UIKit 0x000000010ba59950 -[UIImageView setImage:] + 391
7 MyApp 0x000000010945e0d8 _TFC6MyApp23MyCell15prepareForReusefT_T_ + 136
8 MyApp 0x000000010945e112 _TToFC6MyApp23MyCell15prepareForReusefT_T_ + 34
9 UIKit 0x000000010c19aed1 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 773
10 UIKit 0x000000010c19b8ea -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
11 MyApp 0x00000001095bdee2 _TFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 594
12 MyApp 0x00000001095be747 _TToFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 87
13 UIKit 0x000000010c18675f -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 467
14 UIKit 0x000000010c186586 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
15 UIKit 0x000000010c18ba5e -[UICollectionView _updateVisibleCellsNow:] + 4803
16 UIKit 0x000000010c191725 -[UICollectionView layoutSubviews] + 313
17 UIKit 0x000000010b90dab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x000000010d558bf8 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000010d54c440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000010d54c2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x000000010d4da318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x000000010d5073ff _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x000000010d507d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000010f52c267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000010f52c1d7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010f510f8e __CFRunLoopRun + 1198
27 CoreFoundation 0x000000010f510884 CFRunLoopRunSpecific + 420
28 GraphicsServices 0x0000000112b77a6f GSEventRunModal + 161
29 UIKit 0x000000010b848c68 UIApplicationMain + 159
30 MyApp 0x00000001092f5a7f main + 111
31 libdyld.dylib 0x00000001115b568d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I think the problem is that you are not calling the designated initializer of UIImageView, therefore its image property is not properly initialized and trying to assign to it crashes the app:
-[NSMallocBlock size]: unrecognized selector sent to instance 0x608000880aa0
The method tries to call the size method on the old image but the old image was set to some random memory address.
To fix it, initialize UIImageView properly using the designated initializer:
var coverImageView = UIImageView(image: nil)

Swift ViewController textFieldCancel:]: unrecognized selector sent to instance during segue [duplicate]

This question already has answers here:
"Unrecognized selector sent to instance" error
(3 answers)
Closed 7 years ago.
I've run into an annoying issue when trying to segue to a Pages View Controller from my initial UIViewController. My initial UIViewController, among other things, includes a UITextField. Everytime I attempt to segue out of my initial UIViewController after I've used the UITextField at all, the app crashes with the error below. If I don't interact with the UITextField I seem to be able to use segues at will. From reading other posts I'm lead to believe there are some resources being used by the UITextField that I'm not properly releasing, but after trying numerous longshot attempts at fixing it, I'm left out of ideas/knowledge.
Error Message:
2015-05-22 20:10:13.961 checkdgt[7503:506991] -[checkdgt.ViewController textFieldCancel:]: unrecognized selector sent to instance 0x7f8750826e00
2015-05-22 20:10:14.033 checkdgt[7503:506991] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[checkdgt.ViewController textFieldCancel:]: unrecognized selector sent to instance 0x7f8750826e00'
*** First throw call stack:
(
0 CoreFoundation 0x000000010bd00c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010df63bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010bd080ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010bc5e13c ___forwarding___ + 988
4 CoreFoundation 0x000000010bc5dcd8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010cc5dda2 -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010cd6f54a -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x000000010cd6e09a -[UIControl cancelTouchTracking] + 44
8 UIKit 0x000000010cd6eadd -[UIControl _didMoveFromWindow:toWindow:] + 89
9 UIKit 0x000000010ccd774a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
10 UIKit 0x000000010ccd774a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
11 UIKit 0x000000010cccfecf __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
12 UIKit 0x000000010cccfe43 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
13 UIKit 0x000000010cccdfa3 -[UIView(Hierarchy) removeFromSuperview] + 479
14 UIKit 0x000000010cd6c4dc __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke504 + 657
15 UIKit 0x000000010cd684f2 -[UIPresentationController transitionDidFinish:] + 87
16 UIKit 0x000000010d31a2ed -[_UIFullscreenPresentationController transitionDidFinish:] + 70
17 UIKit 0x000000010cd6ab7c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 133
18 UIKit 0x000000010d3a97c0 -[_UIViewControllerTransitionContext completeTransition:] + 110
19 UIKit 0x000000010cd65be3 -[UITransitionView _didCompleteTransition:] + 1120
20 UIKit 0x000000010ccbc136 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209
21 UIKit 0x000000010ccbc46c -[UIViewAnimationState animationDidStop:finished:] + 76
22 QuartzCore 0x000000010ca43882 _ZN2CA5Layer23run_animation_callbacksEPv + 308
23 libdispatch.dylib 0x000000010e693614 _dispatch_client_callout + 8
24 libdispatch.dylib 0x000000010e67ba1c _dispatch_main_queue_callback_4CF + 1664
25 CoreFoundation 0x000000010bc681f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
26 CoreFoundation 0x000000010bc29dcb __CFRunLoopRun + 2043
27 CoreFoundation 0x000000010bc29366 CFRunLoopRunSpecific + 470
28 GraphicsServices 0x000000010f88ba3e GSEventRunModal + 161
29 UIKit 0x000000010cc5c900 UIApplicationMain + 1282
30 checkdgt 0x000000010b1f3f87 main + 135
31 libdyld.dylib 0x000000010e6c7145 start + 1
32 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Last bit of code before the segue is called:
#IBAction func learnButtonPressed(sender: UIButton) {
view.endEditing(true)
textInputFieldOutlet.resignFirstResponder()
textFieldShouldEndEditing(textInputFieldOutlet)
performSegueWithIdentifier("LearnPagesSegue", sender: nil)
}
I can't find any methods or objects in my code named -textFieldCancel, and the only other UITextField I can think of would be in the included CardIO library, which doesn't seem to be the suspect.
I'm using Xcode 6.3.2 and the latest version of Swift.
Any help or gentle nudges are appreciated.
Thanks!
Check that there isn't an old connection from your button by right clicking on it in the storyboard and examining the outlets in the list. You may have an old connection that you forgot to eliminate.

MKMapRectIntersectsRect throws EXC_BAD_ACCESS

Is this a problem that is caused by adding map pins/annotations and releasing them too often?
My thread trace shows: 0 obj_msgSend and 1 MKMapRectIntersectsRect which lets me know that adding a pin to the map is the problem.
I have a table view which leads to a detail view which contains the map. It seems that the error is only thrown when I quickly tap into and out of my detail view(from segues of different cells). I tried changing the way I released my annotation and removed it from the map view but to no avail.
Crash Log:
Thread 0 Crashed:
0 libobjc.A.dylib 0x37ab5f78 objc_msgSend + 16
1 MyProject 0x000aa954 0xa2000 + 35156
2 UIKit 0x33181c84 -[UIViewController view] + 160
3 UIKit 0x3318e1e2 -[UIViewController contentScrollView] + 18
4 UIKit 0x3318e052 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 30
5 UIKit 0x3318df38 -[UINavigationController _layoutViewController:] + 28
6 UIKit 0x3318d704 -[UINavigationController _startTransition:fromViewController:toViewController:] + 312
7 UIKit 0x3318d4fc -[UINavigationController _startDeferredTransitionIfNeeded] + 244
8 UIKit 0x33181af8 -[UINavigationController pushViewController:transition:forceImmediate:] + 800
9 UIKit 0x331817ce -[UINavigationController pushViewController:animated:] + 30
10 UIKit 0x331fa8fc -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 880
11 UIKit 0x33274620 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 152
12 Foundation 0x3522e92c __NSFireDelayedPerform + 408
13 CoreFoundation 0x356e8a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
14 CoreFoundation 0x356e8692 __CFRunLoopDoTimer + 358
15 CoreFoundation 0x356e7268 __CFRunLoopRun + 1200
16 CoreFoundation 0x3566a49e CFRunLoopRunSpecific + 294
17 CoreFoundation 0x3566a366 CFRunLoopRunInMode + 98
18 GraphicsServices 0x37306432 GSEventRunModal + 130
19 UIKit 0x33176cce UIApplicationMain + 1074
20 MyProject 0x000a3a46 0xa2000 + 6726
21 MyProject 0x000a39f0 0xa2000 + 6640

iOS Application Terminates After Exception Thrown in UITableViewDataSource Method

Having meticulously followed the examples and instructions in the Table View Programming Guide for iOS about the proper order in which UITableView delegate and data source methods are called, I thought I had a good idea of how to implement the “handshake” shown in Figure 7-1 and the list that follows, but apparently not.
Here's the code I'm using…
- (void) tableView: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath {
NSLog(#"Removing %# row %d.", [dataModel objectAtIndex: indexPath.row], indexPath.row);
[tableView deleteRowsAtIndexPaths: [NSArray arrayWithObjects: indexPath, nil] withRowAnimation: UITableViewRowAnimationFade];
[dataModel removeObjectAtIndex: indexPath.row];
}
tableView is the UITableView
dataModel is an NSArray instance that holds the objects represented by the UITableViewCells from the tableView.
…and the error I'm getting…
2010-08-27 21:53:17.971 SportWatch[1299:307] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-1262.58/UITableView.m:920
2010-08-27 21:53:17.992 SportWatch[1299:307] *** 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 (4) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).'
*** Call stack at first throw:
(
0 CoreFoundation 0x35411ed3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x311f0811 objc_exception_throw + 24
2 CoreFoundation 0x35411d15 +[NSException raise:format:arguments:] + 68
3 Foundation 0x332b932f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4 UIKit 0x338dcda1 -[UITableView(_UITableViewPrivate) _endCellAnimationsWithContext:] + 4524
5 UIKit 0x338d586d -[UITableView _updateRowsAtIndexPaths:updateAction:withRowAnimation:] + 204
6 UIKit 0x338d5775 -[UITableView deleteRowsAtIndexPaths:withRowAnimation:] + 20
7 SportWatch 0x000060e7 -[MainViewController tableView:commitEditingStyle:forRowAtIndexPath:] + 670
8 UIKit 0x338d3c3f -[UITableView(UITableViewInternal) animateDeletionOfRowWithCell:] + 58
9 UIKit 0x33984071 -[UITableViewCell(UITableViewCellInternal) deleteConfirmationControlWasClicked:] + 28
10 CoreFoundation 0x353b9719 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
11 UIKit 0x33831d59 -[UIApplication sendAction:to:from:forEvent:] + 84
12 UIKit 0x33831cf9 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
13 UIKit 0x33831ccb -[UIControl sendAction:to:forEvent:] + 38
14 UIKit 0x33831a1d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
15 UIKit 0x3383206b -[UIControl touchesEnded:withEvent:] + 342
16 UIKit 0x338309f5 -[UIWindow _sendTouchesForEvent:] + 368
17 UIKit 0x3383036f -[UIWindow sendEvent:] + 262
18 UIKit 0x3382ae13 -[UIApplication sendEvent:] + 298
19 UIKit 0x3382a74b _UIApplicationHandleEvent + 5110
20 GraphicsServices 0x3171a04b PurpleEventCallback + 666
21 CoreFoundation 0x353a6ce3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
22 CoreFoundation 0x353a6ca7 __CFRunLoopDoSource1 + 166
23 CoreFoundation 0x3539956d __CFRunLoopRun + 520
24 CoreFoundation 0x35399277 CFRunLoopRunSpecific + 230
25 CoreFoundation 0x3539917f CFRunLoopRunInMode + 58
26 GraphicsServices 0x317195f3 GSEventRunModal + 114
27 GraphicsServices 0x3171969f GSEventRun + 62
28 UIKit 0x337d148b -[UIApplication _run] + 402
29 UIKit 0x337cf69f UIApplicationMain + 670
30 SportWatch 0x00002b23 main + 70
31 SportWatch 0x00002ad8 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
kill
Current language: auto; currently objective-c
quit
remove the object from the data set before deleting the row.