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 6737497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:15:21+00:00 2026-05-26T11:15:21+00:00

I have got a UIPickerView. When I select a row, this happens: – (void)pickerView:(UIPickerView

  • 0

I have got a UIPickerView. When I select a row, this happens:

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

switch ([defaults integerForKey:@"randomIndex"]) {
    case 1:
        switch (component) {
            case 0:
                [defaults setInteger:row forKey:@"randomIndex"];
                [defaults synchronize];
                [colourPicker reloadAllComponents];
                [colourPicker selectRow:[defaults integerForKey:@"randomIndex"] inComponent:0 animated:NO];
                [colourPicker selectRow:[defaults integerForKey:@"dice1Index"] inComponent:1 animated:NO];
                [colourPicker selectRow:[defaults integerForKey:@"dice2Index"] inComponent:2 animated:NO];
                [colourPicker selectRow:[defaults integerForKey:@"colourIndex"] inComponent:3 animated:NO];
                break;
            case 1:
                [defaults setObject:([diceArray objectAtIndex:row]) forKey:@"dice"];
                [defaults setInteger:row forKey:@"dice1Index"];
                [defaults synchronize];
                break;
            case 2:
                [defaults setObject:([diceArray objectAtIndex:row]) forKey:@"dice"];
                [defaults setInteger:row forKey:@"dice2Index"];
                [defaults synchronize];
                break;
            case 3:
                [defaults setObject:([colourArray objectAtIndex:row]) forKey:@"colour"];
                [defaults setInteger:row forKey:@"colourIndex"];
                [defaults synchronize];
                break;
        }
        break;
    case 0:
        switch (component) {
            case 0:
                [defaults setInteger:row forKey:@"randomIndex"];
                [defaults synchronize];
                [colourPicker reloadAllComponents];
                [colourPicker selectRow:[defaults integerForKey:@"randomIndex"] inComponent:0 animated:NO];
                [colourPicker selectRow:[defaults integerForKey:@"dice1Index"] inComponent:1 animated:NO];
                [colourPicker selectRow:[defaults integerForKey:@"colourIndex"] inComponent:2 animated:NO];
                break;
            case 1:
                [defaults setObject:([diceArray objectAtIndex:row]) forKey:@"dice"];
                [defaults setInteger:row forKey:@"dice1Index"];
                [defaults synchronize];
                break;
            case 2:
                [defaults setObject:([colourArray objectAtIndex:row]) forKey:@"colour"];
                [defaults setInteger:row forKey:@"colourIndex"];
                [defaults synchronize];
                break;
        }
        break;
}

}

In the iOS Simulator, when I go onto the UIPicker View and change the 1st column to the second row and then back to the first a get a SIGABRT fatal error. Here is the log:

2011-10-27 16:02:55.516 Random[31369:b303] *** Terminating app due to uncaught exception       'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 3 beyond bounds [0 ..   2]'
 *** Call stack at first throw:
 (
0   CoreFoundation                      0x00dc45a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x00f18313 objc_exception_throw + 44
2   CoreFoundation                      0x00dba0a5 -[__NSArrayM objectAtIndex:] + 261
3   UIKit                               0x0000b750 -[UIPickerView      _selectRow:inComponent:animated:notify:] + 125
4   UIKit                               0x0000b6cd -[UIPickerView  selectRow:inComponent:animated:] + 64
5   Random                              0x00004747 -[FlipsideViewController  pickerView:didSelectRow:inComponent:] + 855
6   UIKit                               0x0000bc34 -[UIPickerView  _sendSelectionChangedForComponent:] + 100
7   UIKit                               0x0000ba15 -[UIPickerView  scrollerDidEndSmoothScrolling:] + 75
8   UIKit                               0x001b97c7 -[UIScroller(Internal)  _stopScrollingNotify:dealloc:pin:] + 692
9   UIKit                               0x001bb1d0 -[UIScroller(Static)  _smoothScroll:] + 4743
10  UIKit                               0x001b1488 ScrollerHeartbeatCallback + 129
11  GraphicsServices                    0x00fff3a3 HeartbeatTimerCallback + 35
12  CoreFoundation                      0x00da58c3  __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
13  CoreFoundation                      0x00da6e74 __CFRunLoopDoTimer + 1220
14  CoreFoundation                      0x00d032c9 __CFRunLoopRun + 1817
15  CoreFoundation                      0x00d02840 CFRunLoopRunSpecific + 208
16  CoreFoundation                      0x00d02761 CFRunLoopRunInMode + 97
17  GraphicsServices                    0x00ffc1c4 GSEventRunModal + 217
18  GraphicsServices                    0x00ffc289 GSEventRun + 115
19  UIKit                               0x00024c93 UIApplicationMain + 1160
20  Random                              0x00001cb9 main + 121
21  Random                              0x00001c35 start + 53
22  ???                                 0x00000001 0x0 + 1
    )
terminate called throwing an exceptionCurrent language:  auto; currently objective-c
(gdb) 

Why is this happening?

  • 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-26T11:15:21+00:00Added an answer on May 26, 2026 at 11:15 am

    One of your calls to [UIPickerView selectRow:inComponent:animated:] is asking the system to select the fourth entry (index: 3) in a column that only has 3 rows (max index: 2). Without seeing more of your code I cannot tell you why this is happening.

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

Sidebar

Related Questions

I have got this error when using Enterprise Library 3.1 May 2007 version. We
I have got a StartCommand Class: public class StartCommand : ICommand { public void
I have got @grid.GetHtml( tableStyle: grid, headerStyle: head, alternatingRowStyle: alt, rowStyle: row, selectedRowStyle: selected-row,
I have got the following table where if more than 1 row contain the
I have got an application developed with Monotouch 4.0.7. This app is running on
I have got an undirected weighted connected graph. If I select one vertex I
have got a problem with do this kind of code , can't figure how
I have got this error message: #2002 - The server is not responding (or
I have got a std::string like this: std::string fileName; where fileName is like /tmp/fs////js//config.js
I have got a variable called name here Name = $(this).attr(title); I need to

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.