Xcode Storyboard - UITableViewCell UISwitch Value Changed - xcode

I have am using Xcode storyboards and have a View Controller that has a UITableView which in turn has a custom UITableViewCell.
The UITableViewCell has a UISwitch in it and I want to know when the value has changed. I have a IBAction that successfully fires when the value is changed
- (IBAction)updateSwitchAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"In SettingsViewcontroller updateSwitchAtIndexPath row=|%d \n", indexPath.row);
}
However when it fires the app terminates
2014-07-10 23:38:10.037 reactor[2572:60b] -[UISwitch row]: unrecognized selector sent to instance 0x944b7e0
2014-07-10 23:38:10.072 reactor[2572:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISwitch row]: unrecognized selector sent to instance 0x944b7e0'
*** First throw call stack:
(
0 CoreFoundation 0x01a281e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015758e5 objc_exception_throw + 44
2 CoreFoundation 0x01ac5243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01a1850b ___forwarding___ + 1019
4 CoreFoundation 0x01a180ee _CF_forwarding_prep_0 + 14
5 positivity 0x00003807 -[SettingsViewController updateSwitchAtIndexPath:] + 87
6 libobjc.A.dylib 0x0158782b -[NSObject performSelector:withObject:] + 70
7 UIKit 0x002373b9 -[UIApplication sendAction:to:from:forEvent:] + 108
8 UIKit 0x00237345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
9 UIKit 0x00338bd1 -[UIControl sendAction:to:forEvent:] + 66
10 UIKit 0x00338fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
11 UIKit 0x004c97a5 __31-[UISwitch _handleLongPressNL:]_block_invoke + 85
12 UIKit 0x004c8666 -[_UISwitchInternalViewNeueStyle1 _setPressed:on:animated:shouldAnimateLabels:completion:] + 243
13 UIKit 0x004c9681 -[UISwitch _handleLongPressNL:] + 286
14 UIKit 0x005d14f4 _UIGestureRecognizerSendActions + 230
15 UIKit 0x005d0168 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
16 UIKit 0x005d1bdd -[UIGestureRecognizer _delayedUpdateGesture] + 60
17 UIKit 0x005d513d ___UIGestureRecognizerUpdate_block_invoke + 57
18 UIKit 0x005d50be _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
19 UIKit 0x005cb7ac _UIGestureRecognizerUpdate + 199
20 UIKit 0x00276a5a -[UIWindow _sendGesturesForEvent:] + 1291
21 UIKit 0x00277971 -[UIWindow sendEvent:] + 1021
22 UIKit 0x002495f2 -[UIApplication sendEvent:] + 242
23 UIKit 0x00233353 _UIApplicationHandleEventQueue + 11455
24 CoreFoundation 0x019b177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
25 CoreFoundation 0x019b110b __CFRunLoopDoSources0 + 235
26 CoreFoundation 0x019ce1ae __CFRunLoopRun + 910
27 CoreFoundation 0x019cd9d3 CFRunLoopRunSpecific + 467
28 CoreFoundation 0x019cd7eb CFRunLoopRunInMode + 123
29 GraphicsServices 0x03a1c5ee GSEventRunModal + 192
30 GraphicsServices 0x03a1c42b GSEventRun + 104
31 UIKit 0x00235f9b UIApplicationMain + 1225
32 positivity 0x00005dbd main + 141
33 libdyld.dylib 0x0206f701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any help would be greatly appreciated

UISwitch does not have a property called "row." The way your IBOutlet is set up, you will actually get an UISwitch object as a parameter instead of NSIndexPath.
The better thing to do here is to use the delegate pattern. That way, the custom cell can notify the UIViewController (containing the UITableView) that the switch has been pressed.
So it would be more like:
- (IBAction)updateSwitchAtIndexPath:(UISwitch *)mySwitch
{
// notify the delegate about the switch update
if ([self.delegate respondsToSelector:#selector(switchWasPressed:)]) {
[self.delegate switchWasPressed:mySwitch];
}
}

Related

Swift Error - "Unrecognized selector sent to instance"

I am working on a Swift project in Xcode v6.1.1, and I am getting the following error that I don't understand. I believe there is a problem with a couple of the Labels in my Main.storyboard and/or the UILabel variable I have them connected to.
I have tried everything I can find to fix it, and nothing has worked.
Any help would be appreciated.
2015-03-02 19:43:14.854 Final Project[7380:250494] -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810
2015-03-02 19:43:14.876 Final Project[7380:250494] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810'
*** First throw call stack:
(
0 CoreFoundation 0x00686946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x02062a97 objc_exception_throw + 44
2 CoreFoundation 0x0068e5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x005d73e7 ___forwarding___ + 1047
4 CoreFoundation 0x005d6fae _CF_forwarding_prep_0 + 14
5 Foundation 0x00b0b6dc _NSSetLongValueForKeyWithMethod + 69
6 Foundation 0x00a691c6 _NSSetUsingKeyValueSetter + 257
7 Foundation 0x00a690bd -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
8 Foundation 0x00a9e9a6 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386
9 UIKit 0x011cf649 -[UIRuntimeOutletConnection connect] + 106
10 libobjc.A.dylib 0x02078724 -[NSObject performSelector:] + 62
11 CoreFoundation 0x005c05dc -[NSArray makeObjectsPerformSelector:] + 316
12 UIKit 0x011ce10a -[UINib instantiateWithOwner:options:] + 1775
13 UIKit 0x00ff0624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
14 UIKit 0x00ff0dbb -[UIViewController loadView] + 295
15 UIKit 0x00ff0fef -[UIViewController loadViewIfRequired] + 78
16 UIKit 0x00ff1595 -[UIViewController view] + 35
17 UIKit 0x01664707 -[_UIFullscreenPresentationController _setPresentedViewController:] + 75
18 UIKit 0x00fc6a81 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 113
19 UIKit 0x00ffea61 -[UIViewController _presentViewController:withAnimationController:completion:] + 2102
20 UIKit 0x010015d2 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 345
21 UIKit 0x01001424 -[UIViewController presentViewController:animated:completion:] + 224
22 UIKit 0x010060be -[UIViewController _showViewController:withAction:sender:] + 213
23 UIKit 0x012423b5 -[UIStoryboardShowSegue perform] + 143
24 UIKit 0x014b6b49 -[UIStoryboardSegueTemplate _perform:] + 217
25 UIKit 0x014b6bc5 -[UIStoryboardSegueTemplate perform:] + 116
26 libobjc.A.dylib 0x020787cd -[NSObject performSelector:withObject:withObject:] + 84
27 UIKit 0x00e9b23d -[UIApplication sendAction:to:from:forEvent:] + 99
28 UIKit 0x00e9b1cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
29 UIKit 0x00fcee86 -[UIControl sendAction:to:forEvent:] + 69
30 UIKit 0x00fcf2a3 -[UIControl _sendActionsForEvents:withEvent:] + 598
31 UIKit 0x00fce50d -[UIControl touchesEnded:withEvent:] + 660
32 UIKit 0x00eeb60a -[UIWindow _sendTouchesForEvent:] + 874
33 UIKit 0x00eec0e5 -[UIWindow sendEvent:] + 791
34 UIKit 0x00eb1549 -[UIApplication sendEvent:] + 242
35 UIKit 0x00ec137e _UIApplicationHandleEventFromQueueEvent + 20690
36 UIKit 0x00e95b19 _UIApplicationHandleEventQueue + 2206
37 CoreFoundation 0x005aa1df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
38 CoreFoundation 0x0059fced __CFRunLoopDoSources0 + 253
39 CoreFoundation 0x0059f248 __CFRunLoopRun + 952
40 CoreFoundation 0x0059ebcb CFRunLoopRunSpecific + 443
41 CoreFoundation 0x0059e9fb CFRunLoopRunInMode + 123
42 GraphicsServices 0x0441a24f GSEventRunModal + 192
43 GraphicsServices 0x0441a08c GSEventRun + 104
44 UIKit 0x00e998b6 UIApplicationMain + 1526
45 Final Project 0x000e904e top_level_code + 78
46 Final Project 0x000e908b main + 43
47 libdyld.dylib 0x027cfac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Have you forgot a : in the string name?
Is your class marked with #objc?
Just by looking at -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810 gives me the answer. You are treating a UILabel as an NSString.
Somewhere in your code you have [label longValue] where you mean to have [label.text longValue].
After looking at more of your call stack. I can see that it's happening while a while initializing a view controller from a storyboard.
Have you subclassed any views? It looks like you might have inadvertently changed the type of a property from NSString to UILabel.
So... I fixed the problem. Turned out the answer was right in front of me the whole time (it usually is). The Label that couldn't be initialized had the same name as an Int variable I had declared in the same class, only with the first letter capitalized. For some reason, I assumed it was case-sensitive, so that wouldn't matter...

HandleLongPress : UIPopoverController dealloc reached while popover is still visible

I'm trying to develop a Mapkit app. There is a map, a lot of annotations located on this map. If I touch one of these annotations my app is displaying a custom popover from a storyboard. If I touch another location on view while popover is active, popover disappears without any problem.
But, if I touch one of annotation and move my finger out of annotation without releasing my finger, I got the error.
2014-08-01 11:33:34.160 notamTR[1101:60b] *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'
*** First throw call stack:
(
0 CoreFoundation 0x01b231e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018208e5 objc_exception_throw + 44
2 CoreFoundation 0x01b22fbb +[NSException raise:format:] + 139
3 UIKit 0x00ae195e -[UIPopoverController dealloc] + 86
4 libobjc.A.dylib 0x01831692 _ZN11objc_object17sidetable_releaseEb + 268
5 libobjc.A.dylib 0x01830e81 objc_release + 49
6 myMap 0x0000b82d -[ViewController mapView:didSelectAnnotationView:] + 1885
7 MapKit 0x0017799d -[MKMapView annotationManager:didSelectAnnotationRepresentation:] + 704
8 MapKit 0x001ae9b8 -[MKAnnotationManager selectAnnotation:animated:avoid:] + 715
9 MapKit 0x001ae6e8 -[MKAnnotationManager selectAnnotation:animated:] + 75
10 MapKit 0x00165206 -[MKMapView handleLongPress:] + 993
11 UIKit 0x0087c4f4 _UIGestureRecognizerSendActions + 230
12 UIKit 0x0087b168 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
13 UIKit 0x0087cbdd -[UIGestureRecognizer _delayedUpdateGesture] + 60
14 UIKit 0x0088013d ___UIGestureRecognizerUpdate_block_invoke + 57
15 UIKit 0x008800be _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
16 UIKit 0x008767ac _UIGestureRecognizerUpdate + 199
17 UIKit 0x00521a5a -[UIWindow _sendGesturesForEvent:] + 1291
18 UIKit 0x00522971 -[UIWindow sendEvent:] + 1021
19 UIKit 0x004f45f2 -[UIApplication sendEvent:] + 242
20 UIKit 0x004de353 _UIApplicationHandleEventQueue + 11455
21 CoreFoundation 0x01aac77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
22 CoreFoundation 0x01aac10b __CFRunLoopDoSources0 + 235
23 CoreFoundation 0x01ac91ae __CFRunLoopRun + 910
24 CoreFoundation 0x01ac89d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x01ac87eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x032df5ee GSEventRunModal + 192
27 GraphicsServices 0x032df42b GSEventRun + 104
28 UIKit 0x004e0f9b UIApplicationMain + 1225
29 myMap 0x0001c37c main + 92
30 libdyld.dylib 0x020e4701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It is quite late with this Answer, but for those looking for a solution: Try to create a storong property to hold this popover, and then when taping on the map accessory use the self.popover reference to init it with a content.

Strange memory error in Xcode

I'm getting some strange memory errors in Xcode; it's accessing code from other apps which is very strange.
Here is the code:
[Session started at 2011-03-08 17:04:33 +0800.]
2011-03-08 17:04:59.438 Movie[5309:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MovieViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00daebe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f035c2 objc_exception_throw + 47
2 CoreFoundation 0x00d67628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d6759a +[NSException raise:format:] + 58
4 UIKit 0x00367b75 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00365709 -[UIViewController loadView] + 120
6 UIKit 0x003655e3 -[UIViewController view] + 56
7 Movie 0x00002466 -[MovieAppDelegate application:didFinishLaunchingWithOptions:] + 79
8 UIKit 0x002b81fa -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
9 UIKit 0x002ba55e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
10 UIKit 0x002c4db2 -[UIApplication handleEvent:withNewEvent:] + 1533
11 UIKit 0x002bd202 -[UIApplication sendEvent:] + 71
12 UIKit 0x002c2732 _UIApplicationHandleEvent + 7576
13 GraphicsServices 0x016e4a36 PurpleEventCallback + 1550
14 CoreFoundation 0x00d90064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x00cf06f7 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x00ced983 __CFRunLoopRun + 979
17 CoreFoundation 0x00ced240 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00ced161 CFRunLoopRunInMode + 97
19 UIKit 0x002b9fa8 -[UIApplication _run] + 636
20 UIKit 0x002c642e UIApplicationMain + 1160
21 Movie 0x000023f4 main + 102
22 Movie 0x00002385 start + 53
)
terminate called after throwing an instance of 'NSException'
Can you tell me what this means?
Thanks in advance!
It says in plain english what the problem is: "[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MovieViewController" nib but the view outlet was not set". Set the view outlet in Interface Builder and that's it.

application terminating due to an uncaught exception , when using :(id) sender on an IBAction

I have an application that is using a modal view that has some buttons on it. When I press a button I am calling the following function:
-(IBAction)iconWasSelected:(id) sender
{
NSLog(#"icon button was pressed");
[self dismissModalViewControllerAnimated:YES];
}
If I remove the :(id) sender; it works just fine, but I am trying to get the object that is triggering the function.
This is the error its "vomiting":
2011-03-11 22:59:55.793 app[14107:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IconPickerViewController iconWasSelected]: unrecognized selector sent to instance 0x800bbf0'
*** Call stack at first throw:
(
0 CoreFoundation 0x01629be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0177e5c2 objc_exception_throw + 47
2 CoreFoundation 0x0162b6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0159b366 ___forwarding___ + 966
4 CoreFoundation 0x0159af22 _CF_forwarding_prep_0 + 50
5 UIKit 0x0053da6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x005cc1b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x005ce647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x005cd1f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x005620d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0054337a -[UIApplication sendEvent:] + 447
11 UIKit 0x00548732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x01ce4a36 PurpleEventCallback + 1550
13 CoreFoundation 0x0160b064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x0156b6f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x01568983 __CFRunLoopRun + 979
16 CoreFoundation 0x01568240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x01568161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01ce3268 GSEventRunModal + 217
19 GraphicsServices 0x01ce332d GSEventRun + 115
20 UIKit 0x0054c42e UIApplicationMain + 1160
21 naggy 0x00002298 main + 102
22 naggy 0x00002229 start + 53
)
terminate called after throwing an instance of 'NSException'
Any clues?!! Help and Thanks!!
If you're calling the method programmatically, then make sure you set the action correctly. For example, this will work when (id)sender is present:
UIBarButtonItem *newButton = [[UIBarButtonItem alloc] initWithTitle:#"CLICK ME"
style:UIBarButtonItemStyleBordered
target:self
action:#selector(iconWasSelected:)];
and this will work when (id)sender is not present:
UIBarButtonItem *newButton = [[UIBarButtonItem alloc] initWithTitle:#"CLICK ME"
style:UIBarButtonItemStyleBordered
target:self
action:#selector(iconWasSelected)];
Notice the only difference in the code is the colon!

One line keeps crashing, I think it could be something to do with CFDictionary but not sure. Please help

I have a line of code that keeps crashing
NSArray* address = [NSArray arrayWithArray:[[[access.filteredResults objectAtIndex:[indexPath row]] addressArray] objectAtIndex:0]];
I debugged it and I discovered that addressArray is the culprit.
It's defined in a class called ABContact (created by Erica Sadun, author of Developer Cookbook)
#property (nonatomic, readonly) NSArray *addressArray;
The implementation file has
- (NSArray *) addressArray {return [self arrayForProperty:kABPersonAddressProperty];}
The error message that I get is
-[__NSCFDictionary getObjects:range:]: unrecognized selector sent to instance 0x18aeb0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary getObjects:range:]: unrecognized selector sent to instance 0x18aeb0'
*** Call stack at first throw:
(
0 CoreFoundation 0x3284b987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x31aca49d objc_exception_throw + 24
2 CoreFoundation 0x3284d133 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x327f4aa9 ___forwarding___ + 508
4 CoreFoundation 0x327f4860 _CF_forwarding_prep_0 + 48
5 CoreFoundation 0x327dc325 -[NSArray initWithArray:range:copyItems:] + 372
6 CoreFoundation 0x327e94d3 +[NSArray arrayWithArray:] + 62
7 ContactMapper 0x00003c17 -[RootViewController tableView:cellForRowAtIndexPath:] + 1110
8 UIKit 0x32c46a21 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 516
9 UIKit 0x32c467f3 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 34
10 UIKit 0x32c44d2d -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 936
11 UIKit 0x32c43edd -[UITableView layoutSubviews] + 140
12 UIKit 0x32bf00cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
13 CoreFoundation 0x327e9bbf -[NSObject(NSObject) performSelector:withObject:] + 22
14 QuartzCore 0x3087b685 -[CALayer layoutSublayers] + 120
15 QuartzCore 0x3087b43d CALayerLayoutIfNeeded + 184
16 QuartzCore 0x3089e593 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 18
17 UIKit 0x32c1c3f3 -[UIView(Hierarchy) layoutBelowIfNeeded] + 22
18 UIKit 0x32e41cb3 -[UISplitViewController willRotateToInterfaceOrientation:duration:] + 614
19 UIKit 0x32cadc71 -[UIViewController window:willRotateToInterfaceOrientation:duration:] + 540
20 UIKit 0x32ced6b3 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 1158
21 UIKit 0x32caef5f -[UIWindow _setRotatableViewOrientation:duration:force:] + 54
22 UIKit 0x32c27007 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 74
23 UIKit 0x32c26f81 -[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 112
24 UIKit 0x32c26ead -[UIWindow _handleDeviceOrientationChange:] + 88
25 Foundation 0x320f1623 _nsnote_callback + 142
26 CoreFoundation 0x327d2123 __CFXNotificationPost_old + 402
27 CoreFoundation 0x327d1dc3 _CFXNotificationPostNotification + 118
28 Foundation 0x320e0d23 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
29 UIKit 0x32bf0819 -[UIDevice setOrientation:animated:] + 144
30 UIKit 0x32c152ff -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 438
31 UIKit 0x32be148b -[UIApplication handleEvent:withNewEvent:] + 1114
32 UIKit 0x32be0ec9 -[UIApplication sendEvent:] + 44
33 UIKit 0x32be0907 _UIApplicationHandleEvent + 5090
34 GraphicsServices 0x3094af03 PurpleEventCallback + 666
35 CoreFoundation 0x327e06ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
36 CoreFoundation 0x327e06c3 __CFRunLoopDoSource1 + 166
37 CoreFoundation 0x327d2f7d __CFRunLoopRun + 520
38 CoreFoundation 0x327d2c87 CFRunLoopRunSpecific + 230
39 CoreFoundation 0x327d2b8f CFRunLoopRunInMode + 58
40 UIKit 0x32c14309 -[UIApplication _run] + 380
41 UIKit 0x32c11e93 UIApplicationMain + 670
42 ContactMapper 0x00002b67 main + 70
43 ContactMapper 0x00002b1c start + 40
I'm not sure how to fix it?
access.filteredResults is an NSArray
It might be how AddressBook data is handled (CFDictionary vs NSArray or NSDictionary). I've spent 15 hours and I'm stuck. Any help would be appreciated.
Nope. NSCFDictionary has nothing to do with your problem.
Your problem is that you have under-retained or over-released an array object, and that object died, and another object (in this case, it was a dictionary, but it could have been anything) got allocated at the same address. Your code is trying to create an array with the old object, but ends up passing the dictionary that has succeeded it instead.
You need to find out where you are unduly releasing or failing to retain the value of addressArray.
It may help to run your app under the Zombies instrument, whose very purpose is debugging an application that prematurely releases or fails to retain an object.

Resources