Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7069359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:26:09+00:00 2026-05-28T05:26:09+00:00

I have a UITableViewCell that has 2 UIButton instances. Both buttons have a default

  • 0

I have a UITableViewCell that has 2 UIButton instances. Both buttons have a default image. Only the “bad” button has an image for the disabled state. Nothing more.

In the cell class these two buttons are declared as properties with the IBOutlet keyword:

@property (nonatomic, readonly) IBOutlet UIButton* buttonCall;
@property (nonatomic, readonly) IBOutlet UIButton* buttonGPS;

The connections between the 2 buttons in the .xib and the properties in the class are made.

So, when the .xib is loaded the following is done:

MyCell* cell = (MyCell*)[tableView dequeueReusableCellWithIdentifier:cellID];
if (nil == cell)
{
    NSArray* nibContents = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:nil options:nil];
    cell = [nibContents objectAtIndex:0];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}

// gps button
[cell.buttonGPS setTitle:[NSString stringWithFormat:@"%d", indexPath.row] forState:UIControlStateNormal];
[cell.buttonGPS addTarget:self action:@selector(actionGPS:) forControlEvents:UIControlEventTouchUpInside];

if (...condition...)
{
    cell.buttonCall.enabled = NO;
    [cell.buttonCall removeTarget:self action:@selector(actionCall:) forControlEvents:UIControlEventTouchUpInside];
}
else
{
    cell.buttonCall.enabled = YES;
    [cell.buttonCall setTitle:[...TheTitleString...] forState:UIControlStateNormal];
    [cell.buttonCall addTarget:self action:@selector(actionCall:) forControlEvents:UIControlEventTouchUpInside];
}

When the view controller appears it goes successfully through (UITableViewCell*)tableView:cellForRowAtIndexPath: the necessary number of times. Then the app crashes with the following stack:

0 kill
...
[UIButton imageRectForContentRect:]
[UIButton(UIButtonInternal) _setupImageView]
[UIButton layoutSubviews]
...
start

I removed the image of the button and started crashing with stack:

0 kill
...
[UIButton layoutSubviews]
...
start

I added some identifier labels for the buttons – still crashing.

Removed the XCode-InterfaceBuilder connection for the “bad” button and the crashes stopped. But the button is not functional.

Any idea what is causing the crashes?

Call stack is:

0   CoreFoundation                      0x013d406e __exceptionPreprocess + 206
1   libobjc.A.dylib                     0x019f0d0a objc_exception_throw + 44
2   CoreFoundation                      0x013d5ced -[NSObject doesNotRecognizeSelector:] + 253
3   CoreFoundation                      0x0133af00 ___forwarding___ + 432
4   CoreFoundation                      0x0133ace2 _CF_forwarding_prep_0 + 50
5   UIKit                               0x0086de3a -[UIButton imageRectForContentRect:] + 350
6   UIKit                               0x0086ed5b -[UIButton(UIButtonInternal) _setupImageView] + 158
7   UIKit                               0x0086e5f8 -[UIButton layoutSubviews] + 693
8   UIKit                               0x0069f322 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 178
9   CoreFoundation                      0x013d5e72 -[NSObject performSelector:withObject:] + 66
10  QuartzCore                          0x0042092d -[CALayer layoutSublayers] + 266
11  QuartzCore                          0x0042a827 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 231
12  QuartzCore                          0x003b0fa7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 377
13  QuartzCore                          0x003b2ea6 _ZN2CA11Transaction6commitEv + 374
14  QuartzCore                          0x003b2580 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 80
15  CoreFoundation                      0x013a89ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
16  CoreFoundation                      0x0133f670 __CFRunLoopDoObservers + 384
17  CoreFoundation                      0x0130b4f6 __CFRunLoopRun + 1174
18  CoreFoundation                      0x0130adb4 CFRunLoopRunSpecific + 212
19  CoreFoundation                      0x0130accb CFRunLoopRunInMode + 123
20  GraphicsServices                    0x03258879 GSEventRunModal + 207
21  GraphicsServices                    0x0325893e GSEventRun + 114
22  UIKit                               0x00660a9b UIApplicationMain + 1175
23  MyApp                               0x000023f9 main + 169
24  MyApp                               0x00002345 start + 53

Exception is:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x146acd8'

info symbol 0x146acd8
__kCFNull in section LC_SEGMENT.__DATA.__data of /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation

The second scenario is similar. The exception, however, is exactly the same. Here is the call stack:

0   CoreFoundation                      0x013d406e __exceptionPreprocess + 206
1   libobjc.A.dylib                     0x019f0d0a objc_exception_throw + 44
2   CoreFoundation                      0x013d5ced -[NSObject doesNotRecognizeSelector:] + 253
3   CoreFoundation                      0x0133af00 ___forwarding___ + 432
4   CoreFoundation                      0x0133ace2 _CF_forwarding_prep_0 + 50
5   UIKit                               0x0086e851 -[UIButton layoutSubviews] + 1294
6   UIKit                               0x0069f322 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 178
7   CoreFoundation                      0x013d5e72 -[NSObject performSelector:withObject:] + 66
8   QuartzCore                          0x0042092d -[CALayer layoutSublayers] + 266
9   QuartzCore                          0x0042a827 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 231
10  QuartzCore                          0x003b0fa7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 377
11  QuartzCore                          0x003b2ea6 _ZN2CA11Transaction6commitEv + 374
12  QuartzCore                          0x003b2580 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 80
13  CoreFoundation                      0x013a89ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
14  CoreFoundation                      0x0133f670 __CFRunLoopDoObservers + 384
15  CoreFoundation                      0x0130b4f6 __CFRunLoopRun + 1174
16  CoreFoundation                      0x0130adb4 CFRunLoopRunSpecific + 212
17  CoreFoundation                      0x0130accb CFRunLoopRunInMode + 123
18  GraphicsServices                    0x03258879 GSEventRunModal + 207
19  GraphicsServices                    0x0325893e GSEventRun + 114
20  UIKit                               0x00660a9b UIApplicationMain + 1175
21  MyApp                               0x000023f9 main + 169
22  MyApp                               0x00002345 start + 53
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:26:10+00:00Added an answer on May 28, 2026 at 5:26 am

    From the exception, it looks like you think you are passing an NSString to the title of a button, and you are in fact passing an instance of NSNull. This is quite common if you are deriving your table view data from a JSON source or similar – NSNull is used if the source field does not exist.

    The exception you get is that length is not a recognised selector for NSNull, which is true, and it seems to come up when the button is laying out its subviews, which it would do when you assign a new title. So I would focus your investigation in that area. Check to see what you are actually sending for the title of the button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom UITableViewCell nib that has an image on the left side
I have a custom UITableViewCell that has 2 buttons and a label on it.
Similar to this question I have a custom subclass of UITableViewCell that has a
I have a UITableViewCell that has some labels and images that can be clicked.
I have a table containing images and buttons. Each button has a tag with
I have a custom UITableViewCell that has a UISegmentedControl object. My UITableView (questionnaire form)
i have a very simple table with only one row that has a uiswitch
I have a UIButton that is added to each UITableViewCell (except for 2 cells)
I have a UITableViewCell that has an integrated UITextView. The goal is to make
I have a UITextField that I put into a UITableViewCell that I put into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.