13

Hi I seem to have stumbled upon weird thing while developing a storyboard app.

My app is halted right after splash screen and in console I get error message:

Missing proxy for identifier UIStoryboardPlaceholder

Now, if I try to let the app continue running, I get new messages into console, which I believe are related to the fact, that there is something wrong with the first error message

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
 '[<IntroViewController 0x6e35f40> setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key sceneViewController.

What is strange I get this error only when working with iOs 5.1 Simulator. It works fine on iOs 6 simulator and also on devices with both iOs 6 and iOs 5.1

I tried to find answer, but google says it could not find any results for the word UIStoryboardPlaceholder, let alone the whole error message. I made sure, I don't have the word 'UIStoryboardPlaceholder' anywhere within my xcode project(not even inside nib files) and also there's nowhere mentioned 'sceneViewController'. Any idea what might be wrong?

EDIT: I tried to reset simulator and cleaning project, but to no avail

Lukas1
  • 582
  • 1
  • 5
  • 28
  • I'm having the same crash on iOS 7 device. It start when I assign a Restoration ID to a storyboard view controller (a tab of a root tab bar controller) that has its view in a separate xib. If I move the view to the storyboard everything is fine. – Vadim Yelagin Oct 23 '13 at 12:55

5 Answers5

27

We had the same problem: a view controller in a storyboard file with its interface defined in a separate XIB file. (Using Xcode 6.3.1, iOS 8.3 and Swift 1.2.)

We are using Swift so we had added the @objc() declaration to the class declaration:

@objc(TestViewController) class TestViewController: UIViewController

We could instantiate the view controller just fine from another view controller using self.storyboard?.instantiateViewControllerWithIdentifier( "TestViewController" ) but when presenting the view controller (using self.presentViewController( viewController, animated: true, completion: nil )) the app crashed with the same "missing proxy" and "not key value coding-compliant for the key sceneViewController" error.

Our solution which we found after much frustrated trial-and-error-like debugging was simply make sure the view controller's Storyboard ID in the storyboard file is not the same as the class name.

When we renamed the Storyboard ID from "TestViewController" to "testViewController" (only difference being the lower-case first letter), everything worked…

Strange? You betcha, but everything seems to be working now.

  • I think the idea "make sure the view controller' Storyboard ID in the storyboard file is not the same as the class name" is greate :). – Huynh Inc Dec 24 '15 at 07:33
  • It works for me as well! Saved my nerves, great thanks! – Mykola Denysyuk Mar 30 '16 at 10:26
  • The lowercase naming solved the issue for me. Thanks for the heads up. Sad error info they could clearly do a better job identifying the problem! – Aggressor Apr 18 '18 at 15:20
  • Absolute genius, thanks so much for sharing! – atineoSE Jul 18 '18 at 14:26
  • It's worth nothing that this problem might happen even when setting the Storyboard ID in just one VC of that class, even when other instances of the same VC in the storyboard don’t have any Storyboard ID. – atineoSE Jul 24 '18 at 09:21
  • Oh wow. I started converting all of my Storyboard IDs to have same name as the class name to be able to use class types to instantiateViewController(withIdentifier:) instead of providing a string and ran into this problem. The exception was certainly puzzling. I still would like to understand clearly why this happens – NeverwinterMoon Sep 07 '18 at 05:44
6

I had the same problem. Try cleaning the project and restoring the simulator.

Micho
  • 928
  • 9
  • 11
3

I was getting the same error with an app that I was converting from .xib files to storyboards. My app contained a UITabBarController, and tapping on certain tabs would trigger the error.

In my case, the problem was that I had copied view controllers into the storyboard that used the "NIB name" property to load the view controller's view from an external .xib file. Storyboard view controllers do not support loading views from .xib files, so my storyboard contained a view controller that had no view.

I opened the external .xib file, copied the view, pasted it into the corresponding view controller in my storyboard, and made sure that the pasted view was subordinate (indented under) the view controller in the storyboard scene. Then I re-connected the view to the outlets in the view controller.

When I re-ran the application, the error was gone.

Stuart Malone
  • 161
  • 1
  • 4
  • 1
    Actually you can have a storyboard view controller with separate xib for its view. Simply name your xib file with the name of the view controller class, e.g. MyViewController.xib. – Vadim Yelagin Oct 23 '13 at 12:57
  • 1
    @vladim - i'm trying to do as you suggest, the docs say you can, but this is what is causing this error. – hooleyhoop Jul 23 '14 at 10:50
1

Add me to the list. I get this error after "refactoring - rename" on a class. The class I am renaming is a custom ViewController with its own .xib. I use Storyboard which launches a viewController containing a "Container View", which has my custom ViewController embedded in it upon launch.

The only way out of this so far is to NOT use my refactored .xib (disconnect it from the container view).

My semi-solution:
I have restored my app from a prior working snapshot and created a new custom ViewController and .xib from scratch instead of refactoring. Connected it to Storyboard and I got the error message again. Cleaned the build and deleted the app from the simulator and re-ran, and then it magically ran without error. For this reason I believe there is a bug in Xcode with Refactor-Rename, which corrupts some storyboard file behind-the-scenes. Once I confirmed that the new .xib was attaching to storyboard without error, I copied/pasted the class code into the new custom viewController class, and went through the process of reconnecting the class objects to the .xib, as you'd expect. Ran it and everything still worked.

FYI - here are some of the FAILED steps I took in my attempt to recover from the error (before giving up and restoring snapshot).
1. Cleaning Build.
2. Deleting App in iOS simulator.
3. Deleting all views in the custom ViewController .xib.
4. Naming the custom ViewController something else.
5. In Storyboard, adding a blank view to the ViewController representing my custom Viewcontroller class. This worked and allowed my app to run, however my custom class was neither able to load its own views in place of this default blank view, nor were it's own views visible upon making the default blank view transparent. Debugging showed my custom class .xib views being nil when assigned to self.view.

I am presently avoiding Xcode's Refactor-Rename for files having a .xib.

ObjectiveTC
  • 2,477
  • 30
  • 22
  • thank you for your insight. I will also be carefull of refactoring now. Unfortunatelly I can't revert to whatever state before it, because I don't remember if I used the feature and that created the problem and have made lots of changes in the mean time. I'm just testing on real device, where I don't encounter any problems – Lukas1 Nov 26 '12 at 09:31
0

I had the same errors, finally solved it. My problem was that I had :

[[storyboard instantiateViewControllerWithIdentifier:@"TripDetail"] methodThatDoesNotExist:@"param"]
Felix M
  • 195
  • 1
  • 9