5

Using iOS 8 and Xcode 6. I embedded a UIWebView in a controller using a storyboard, and hooked everything up. When I run it, though, the webView is coming up nil. Any thoughts?

enter image description here

RyJ
  • 3,995
  • 6
  • 34
  • 54

3 Answers3

1

What helped me is this answer #1 here.

  1. Clean project
  2. Close XCode
  3. Delete all contents of ~/Library/Developer/Xcode/DerivedData/
  4. Restart MacOs

Exactly in this order.

Community
  • 1
  • 1
zshcbka
  • 416
  • 3
  • 14
0

Modify weak @property for webView.

ares777
  • 3,590
  • 1
  • 22
  • 23
0

I encountered this problem myself and finally found a solution: At some point Apple changed the way View Controllers are linked with their xib files. Xcode no longer automatically matches, for example, ViewController.swift and ViewController.xib. Instead you must explicitly specify a nib name in your code. Try calling:

NSBundle.mainBundle().loadNibNamed("ViewController", owner: self, options: nil)

or, in Objective C:

[[NSBundle mainBundle] loadNibNamed:@"ViewController" owner:self options:nil];

in your VC's initializer, before you use any IBOutlets (replacing "ViewController" with the name of your View Controller). This is what finally worked for me (in Swift).

See also:

Are view controllers with nib files broken in ios 8 beta 5?

Swift proper way to load xib file

Community
  • 1
  • 1
pterry26
  • 1,230
  • 1
  • 10
  • 20