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?
Asked
Active
Viewed 865 times
5
-
How are you initializing your view controller? – Anton Unt Jul 09 '14 at 19:23
-
1i am having the same issue when instantiating a view controller from a storyboard. – Kyle Jul 15 '14 at 13:21
-
same issue here. My web view is always nil when the view controller loads – zumzum Jul 25 '14 at 04:17
-
Am also having the same problem. My others viewcontrollers were fine, now any new view controller created within SB have all nil IBOutlets – Andyy Jan 07 '15 at 04:11
-
Modify weak @property for webView. – ares777 Jan 07 '15 at 07:35
-
Same issue. On Simulator all works fine, on device some of the outlets are nil – zshcbka Jan 07 '15 at 20:58
3 Answers
1
What helped me is this answer #1 here.
- Clean project
- Close XCode
- Delete all contents of ~/Library/Developer/Xcode/DerivedData/
- Restart MacOs
Exactly in this order.
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: