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

  • Home
  • SEARCH
  • 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 509387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:00:20+00:00 2026-05-13T07:00:20+00:00

This is my first time using IB, but after spending a one or two

  • 0

This is my first time using IB, but after spending a one or two intimate days with it I believe I’m beginning to understand it. That’s just my way of saying I might be overlooking something simple here:

I’ve set up a UIPickerView and joined it to its DataSource and Delegate object in IB (both different Classes in my case). This allows the picker to show up when I run the app, which is very encouraging when it hasn’t been showing up in any previous test runs. 😉 However, when I scroll the UIPickerView, the program crashes, and I can’t find any of my code referenced in the backtrace. After quite a bit of troubleshooting, I think I’ve narrowed down the crash to two distinct cases, as far as the backtrace is concerned:

the return value of -pickerView:numberOfRowsInComponent: > the number of rows displayed

  • The app crashes as soon as a motion is begun to select a new row
  • The app crashes if I try to use -selectRow:inComponent:animated:

backtrace (ignoring main):

#0  0x955e8688 in objc_msgSend ()
#1  0x0167bea8 in -[UIPickerView table:cellForRow:column:reusing:] ()
#2  0x016773c1 in -[UIPickerView table:cellForRow:column:] ()
#3  0x017fef53 in -[UITable createPreparedCellForRow:column:] ()
#4  0x018077c8 in -[UITable _updateVisibleCellsNow] ()
#5  0x018027cf in -[UITable layoutSubviews] ()
#6  0x03ac42b0 in -[CALayer layoutSublayers] ()
#7  0x03ac406f in CALayerLayoutIfNeeded ()
#8  0x03ac38c6 in CA::Context::commit_transaction ()
#9  0x03ac353a in CA::Transaction::commit ()
#10 0x03acb838 in CA::Transaction::observer_callback ()
#11 0x007b8252 in __CFRunLoopDoObservers ()
#12 0x007b765f in CFRunLoopRunSpecific ()
#13 0x007b6c48 in CFRunLoopRunInMode ()
#14 0x000147ad in GSEventRunModal ()
#15 0x00014872 in GSEventRun ()
#16 0x0168a003 in UIApplicationMain ()

the return value of -pickerView:numberOfRowsInComponent: < the number of rows displayed

  • The app crashes after the motion ceases and the row is selected
  • The app does not crash if I try to use -selectRow:inComponent:animated:

backtrace (ignoring main):

#0  0x955e8688 in objc_msgSend ()
#1  0x0167700d in -[UIPickerView _sendSelectionChangedForComponent:] ()
#2  0x017f4187 in -[UIScroller _scrollAnimationEnded] ()
#3  0x016f732c in -[UIAnimator stopAnimation:] ()
#4  0x016f7154 in -[UIAnimator(Static) _advance:] ()
#5  0x00017739 in HeartbeatTimerCallback ()
#6  0x007b7ac0 in CFRunLoopRunSpecific ()
#7  0x007b6c48 in CFRunLoopRunInMode ()
#8  0x000147ad in GSEventRunModal ()
#9  0x00014872 in GSEventRun ()
#10 0x0168a003 in UIApplicationMain ()

My delegate and datasource implementations follow:

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return (NSInteger)3;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    return (NSInteger)4;
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
  //it will probably be better to use the method following when creating the rows, so I can better customize it 
    return @"strings";
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    NSLog(@"selected a row");
}
  • 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-13T07:00:20+00:00Added an answer on May 13, 2026 at 7:00 am

    Investigated Apple documentation a bit and it proved my previous guess. From Resource Programming Guide:

    Objects in the nib file are created
    with a retain count of 1 and then
    autoreleased. As it rebuilds the
    object hierarchy, however, UIKit
    reestablishes connections between the
    objects using the setValue:forKey:
    method, which uses the available
    setter method or retains the object by
    default if no setter method is
    available. If you define outlets for
    nib-file objects, you should also
    define a setter method for accessing
    that outlet. Setter methods for
    outlets should retain their values,
    and setter methods for outlets
    containing top-level objects must
    retain their values to prevent them
    from being deallocated. If you do not
    store the top-level objects in
    outlets, you must retain either the
    array returned by the
    loadNibNamed:owner:options: method or
    the objects inside the array to
    prevent those objects from being
    released prematurely.

    So the top level objects are created autoreleased and you must retain them in your code. There’s also described recommended way to handle that:

    For both Mac OS X and UIKit, the
    recommended way to manage the
    top-level objects in a nib file is to
    create outlets for them in the File’s
    Owner object and then define setter
    methods to retain and release those
    objects as needed. Setter methods give
    you an appropriate place to include
    your memory-management code, even in
    situations where your application uses
    garbage collection. One easy way to
    implement your setter methods is to
    use the @property syntax and let the
    compiler create them for you.

    I’ve tested this approach in a sample code – defined outlets for delegate and data source objects in file owner class and connected them in IB. And in file owner class defined a property for those outlets:

    @property (nonatomic, retain) NSObject<UIPickerViewDelegate>* myDelegate;
    @property (nonatomic, retain) NSObject<UIPickerViewDataSource>* mySource;
    

    Worked fine.

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

Sidebar

Ask A Question

Stats

  • Questions 275k
  • Answers 275k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In short, no. I don't believe that Quartz or Core… May 13, 2026 at 2:33 pm
  • Editorial Team
    Editorial Team added an answer The $(this) cannot be used in that way, because you… May 13, 2026 at 2:33 pm
  • Editorial Team
    Editorial Team added an answer Since you are using a hash in the URL, you… May 13, 2026 at 2:33 pm

Related Questions

From what I understand of the SDK, this exception is raised when the bindings
I have a fairly simple python loop that calls a few functions, and writes
This is my first time using joomla. I don't know if I'm using the
This is my first time using map tag in html. I assume getting the
This is my first time using java to access databases, so I probably have

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.