2

From what I understand of the SDK, this exception is raised when the bindings in IB are not proper. But in my case, the view is loaded fine for the first two times. I then move back from the view using the NavigationController.

The third time when I try to open the view, I get this exception. The fact that it opens correct the first two times, means the bindings are correct and the view is fine! But then why does it fail the third time?

Any pointers? Thanks.

I am calling -initWithNibName:bundle: to initialize the view which is created in IB. Not calling the -loadView method.


It is not getting garbage collected. AFAIK, there is no garbage collection in iPhone SDK and we need to dealloc stuff explicitly.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
lostInTransit
  • 70,519
  • 61
  • 198
  • 274
  • Does initWithNib get called on the view? Are you calling loadView directly instead of lazy-loading it via the view property? Are you calling your supers in view, loadView and viewDidLoad? – rpetrich Dec 26 '08 at 07:35
  • You might want to use the term "connections" rather than "bindings." In Cocoa terminology, "bindings" has a specific meaning that isn't interchangeable with "connection." – Chris Hanson Dec 29 '08 at 08:23

3 Answers3

8

It seems that you have not bind the view to it's file owner.

For fixing this thing go open the xib which you are using in this ViewController. Right Click on your main view and then bind this view to the File Owener's view property.

Om Prakash
  • 81
  • 1
  • 2
  • Thank you! I've been looking for this for a while now. – codr Nov 17 '10 at 18:49
  • additionally you may need to set the File's Owner to your view controller class (I forget to do this all the time). See the answer shown in http://stackoverflow.com/questions/5227332/view-outlet-not-available-to-files-owner – Vivek Gani Jul 22 '14 at 01:49
2

You may be running low on memory, which forces the system to send out low-memory messages to instantiated view controllers. The default implementation of -didReceiveMemoryWarning clears out the view member variable. In theory, then next time the view is required, it should be re-instantiated, but you may have overridden something that's preventing that.

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
-3

The view object might be going out of scope, and getting garbage collected.

diclophis
  • 2,444
  • 1
  • 17
  • 10
  • There's no garbage collection on the iPhone platform (only the most recent version of the desktop objective-c runtime added it) – rpetrich Dec 26 '08 at 07:28