Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBOutlets are nil on iOS 8 devices, but work fine on iOS 9 (Swift)

When running iOS 8, the IBOutlets of my nib based view controllers are nil, but when running iOS 9, they work fine. Any ideas why this might be happening?

My app supports iOS 8+, and I'm running Xcode 7.2.

like image 257
jjramos Avatar asked Jan 04 '16 11:01

jjramos


1 Answers

The problem was in the way my UIViewController was instantiated. Changing let myVC = MyViewController()

for let myVC = MyViewController(nibName: "MyViewController", bundle: nil) fixed the problem.

like image 200
jjramos Avatar answered Nov 15 '22 21:11

jjramos