Crash while selecting row in component 1 in uipickerview in iOS 6












0















I had an application which was working fine till iOS 5.1. But recently with iOS 6 it has started giving crash when I try to select a row in a component programmatically. Following is my code:



UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator=YES;
[pickerView setTag:10];
//[pickerView selectRow:0 inComponent:0 animated:YES];
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]];
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]];

[actionSheet addSubview:pickerView];
[pickerView selectRow:index1 inComponent:0 animated:YES];
[pickerView selectRow:index2 inComponent:1 animated:YES];
[pickerView release];


It runs fine when I try to select row in component 0 but I get crash when I try to select row in component 1.










share|improve this question

























  • try printing the array .check if the datasource array is null or not?

    – AppleDelegate
    Sep 28 '12 at 11:08











  • yes checking the data helped me. I have added my answer.

    – pankaj
    Oct 7 '12 at 15:57
















0















I had an application which was working fine till iOS 5.1. But recently with iOS 6 it has started giving crash when I try to select a row in a component programmatically. Following is my code:



UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator=YES;
[pickerView setTag:10];
//[pickerView selectRow:0 inComponent:0 animated:YES];
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]];
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]];

[actionSheet addSubview:pickerView];
[pickerView selectRow:index1 inComponent:0 animated:YES];
[pickerView selectRow:index2 inComponent:1 animated:YES];
[pickerView release];


It runs fine when I try to select row in component 0 but I get crash when I try to select row in component 1.










share|improve this question

























  • try printing the array .check if the datasource array is null or not?

    – AppleDelegate
    Sep 28 '12 at 11:08











  • yes checking the data helped me. I have added my answer.

    – pankaj
    Oct 7 '12 at 15:57














0












0








0








I had an application which was working fine till iOS 5.1. But recently with iOS 6 it has started giving crash when I try to select a row in a component programmatically. Following is my code:



UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator=YES;
[pickerView setTag:10];
//[pickerView selectRow:0 inComponent:0 animated:YES];
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]];
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]];

[actionSheet addSubview:pickerView];
[pickerView selectRow:index1 inComponent:0 animated:YES];
[pickerView selectRow:index2 inComponent:1 animated:YES];
[pickerView release];


It runs fine when I try to select row in component 0 but I get crash when I try to select row in component 1.










share|improve this question
















I had an application which was working fine till iOS 5.1. But recently with iOS 6 it has started giving crash when I try to select a row in a component programmatically. Following is my code:



UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator=YES;
[pickerView setTag:10];
//[pickerView selectRow:0 inComponent:0 animated:YES];
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]];
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]];

[actionSheet addSubview:pickerView];
[pickerView selectRow:index1 inComponent:0 animated:YES];
[pickerView selectRow:index2 inComponent:1 animated:YES];
[pickerView release];


It runs fine when I try to select row in component 0 but I get crash when I try to select row in component 1.







iphone uipickerview ios6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 22:13









halfer

14.7k759116




14.7k759116










asked Sep 28 '12 at 10:57









pankajpankaj

2,761125396




2,761125396













  • try printing the array .check if the datasource array is null or not?

    – AppleDelegate
    Sep 28 '12 at 11:08











  • yes checking the data helped me. I have added my answer.

    – pankaj
    Oct 7 '12 at 15:57



















  • try printing the array .check if the datasource array is null or not?

    – AppleDelegate
    Sep 28 '12 at 11:08











  • yes checking the data helped me. I have added my answer.

    – pankaj
    Oct 7 '12 at 15:57

















try printing the array .check if the datasource array is null or not?

– AppleDelegate
Sep 28 '12 at 11:08





try printing the array .check if the datasource array is null or not?

– AppleDelegate
Sep 28 '12 at 11:08













yes checking the data helped me. I have added my answer.

– pankaj
Oct 7 '12 at 15:57





yes checking the data helped me. I have added my answer.

– pankaj
Oct 7 '12 at 15:57












1 Answer
1






active

oldest

votes


















0














ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f12638695%2fcrash-while-selecting-row-in-component-1-in-uipickerview-in-ios-6%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.






    share|improve this answer




























      0














      ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.






      share|improve this answer


























        0












        0








        0







        ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.






        share|improve this answer













        ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 7 '12 at 15:56









        pankajpankaj

        2,761125396




        2,761125396
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f12638695%2fcrash-while-selecting-row-in-component-1-in-uipickerview-in-ios-6%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter