0

I see that someone already asked similar question once before, but no one replied. So I'm going to reask it.

I've created a simple tabbed application for my iPhone with only two views.

First one has some simple text fields and labels etc. nothing special.

When seconds view was still empty all was working just fine. I could navigate between first and second view without any problems. But then, I added to the second view a Picker View component and set it up properly, that is, I added required methods and an array with data that the picker will be populated with. That's it.

So what happened? The app won't go to a second tab now. When I click on the second view button the app crashed with the following exception:

-[__NSCFString attribute:atIndex:effectiveRange:]: unrecognized selector sent to instance 0x2103df30 2013-02-28 09:01:01.540 My App[5040:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString attribute:atIndex:effectiveRange:]: unrecognized selector sent to instance

And a whole lot of hex numbers after that.

At this point I tried to create a single view app with the same picker, and code. I just copy and paste it. The app loads just fine. I don't know why a tabbed application with picker view is crashing then. Apparently this is something other people experienced too, and asked about here on this forum (please see the link below)

Any suggestion? It seems like this is a known issue (or something new developers are not aware of, so we do the same mistake).

Here is the link to the other topic with someone that had the same problem.

Community
  • 1
  • 1
  • 1
    Do you have any code? Does the debugger break on the offending line? – Mike D Feb 28 '13 at 19:04
  • I do have all the code of course and I'll post some little later... I'm at work now, and don't have an access to it. But I'm just wondering if the code works fine with a single view application, the tabbed application must be the one that is causing it to crash. – user2120883 Feb 28 '13 at 19:40
  • Solved the problem. What a mistake.... ;-) – user2120883 Mar 01 '13 at 06:03
  • Instead of this method:- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component – user2120883 Mar 01 '13 at 06:04
  • I had this:- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component – user2120883 Mar 01 '13 at 06:04
  • Hopefully someone will benefit from this thread... – user2120883 Mar 01 '13 at 06:05

0 Answers0