2

I keep getting the error:

Storyboard () doesn't contain a view controller with identifier 'myWebView'.

I am using UITableView and when users click the cell, it will push another view and load a UIWebView. But I am sure that I set the identifier in storyboard correctly, please review the code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSArray *arrInfo = [[tableData objectAtIndex:indexPath.row] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@";"]];

    favWebView *nextView = [self.storyboard instantiateViewControllerWithIdentifier:@"myWebView"];

    nextView.title = [arrInfo objectAtIndex:1];
    nextView.url1 = [arrInfo objectAtIndex:6];
    [self.navigationController pushViewController:nextView animated:YES];
}

the picture:

storyboard

Can anyone tell me how to solve this problem?

pkamb
  • 33,281
  • 23
  • 160
  • 191
DennisCPH
  • 39
  • 1
  • 3
  • Is there only one storyboard in your project? – Phillip Mills Jul 25 '12 at 16:11
  • Yes I have only one storyboard. – DennisCPH Jul 25 '12 at 16:52
  • I just found out an interesting situation. If I set the language of simulator in English, it works just fine, but if I change it to another language then it fails in the same error message. I tried in simulator and real iPhone both, it's still the same problem. Any idea how to solve this problem? Thank you very much. – DennisCPH Jul 25 '12 at 16:52
  • Try changing the Storyboard ID to something else and then back to the original. This worked for me – iamruskie Sep 03 '14 at 19:56

7 Answers7

6

The Solution here is to delete the App from the Simulator or the Device.

Urkman
  • 1,298
  • 1
  • 16
  • 32
1

May have something to do with your sotryboard, maybe this will do something different. Initializing the view differently.

  favWebView *favWebView = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"favWebView"];
DROP TABLE users
  • 1,955
  • 14
  • 26
  • 1
    Thanks, Patrick. I tried this code but it's still not working. But I just found out an interesting situation. If I set the language of simulator in English, it works just fine, but if I change it to another language then it fails in the same error message. I tried in simulator and real iPhone both, it's still the same problem. Any idea that how to solve this problem? Thank you very much. – DennisCPH Jul 25 '12 at 16:50
  • Interesting, completely not what I had originally thought. I'll look in to it. – DROP TABLE users Jul 25 '12 at 18:14
  • Same issue here, and changing to English in simulator does the trick. This is most annoying when you want to check any other language. – Phil Dec 20 '12 at 14:42
1

I solved it by re-creating it in a new project. It is probably an issue with Xcode.

pkamb
  • 33,281
  • 23
  • 160
  • 191
DennisCPH
  • 39
  • 1
  • 3
  • Yeah ran into the same thing and this was the last resort, and it worked. Everything was properly wired up and working, and then after running pod install (cocoapods) I opened the workspace and hit this error. I also added my storyboards to a group, so that may have been to blame instead. Only changes I can account for causing this. – Stephen Handley Sep 22 '12 at 09:00
  • Yes, that's is xCode bug. When you created new project and rename default storyboard, you can catch this error. – Ilya Ilin Oct 13 '12 at 09:14
  • I found that by changing the key `Main storyboard file base name` in info.plist I was able to get the storyboard to find the viewControllerId. – SooDesuNe Oct 25 '12 at 01:07
1

After app was builded, storyboard will be copied into MyApp.app/MyStoryboard.storyboardc. Then, if you localized you storyboards, they will be copied into MyApp.app/(localization.lproj)/MyStoryboard.storyboardc. BUT in iOS Simulator app's folder original storyboard (maybe old, without some view controllers, if you added it after localization) still exists at MyApp.app/MyStoryboard.storyboardc. After run, your app try to instantiateViewControllerWithIdentifier from MyApp.app/MyStoryboard.storyboardc. It can be checked by navigations into iOS Simulator folder and exploring package for you app.

So, that is why it crashes.

avdyushin
  • 1,906
  • 17
  • 21
0

if you have multiple languages, you should make sure in all story board of all localized files, you set the story board id. I found that when I select story board(but not one localized) and set id, only the first localized file will be modified.

Mavlarn
  • 3,807
  • 2
  • 37
  • 57
0

I was having similar problems.

On a hunch I checked what the Storyboard thought the controller was - in the storyboard window on the bar below the actual view. Storyboard had added spaces "MyViewController" became "My View Controller" - anyhow, after adding the spaces to the Storyboard ID and to the instantiateViewControllerWithIdentity - it worked.

thewils
  • 21
  • 2
0

You may need to assign the view controller a "Storyboard ID". This solved it for me.

John Doe
  • 3,559
  • 15
  • 62
  • 111