A very simple Swift code to use ARKit. Mainly let Xcode create an ARKit App and run it. I work fine and shows de Plane.
BUT, when adding to the Storyboard a Navigation Controller and creating a small Menu, with the entry for the Plane Demo and calling now the same ARKit sample, the app crashes.
switch menuItemIndex {
case 0:
let controller = AvionViewController()
self.navigationController?.pushViewController(controller, animated: true)
default:
print("something")
}
The crash is:
2017-06-27 08:08:26.317187-0500 ARDemo[1868:432582] [DYMTLInitPlatform] platform initialization successful fatal error: unexpectedly found nil while unwrapping an Optional value 2017-06-27 08:08:29.546679-0500 ARDemo[1868:432449] fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
So that means, when running the ARKit demo ViewController directly, it works, but when calling the ViewController from another one, the app crashes.
On the other side, when not using @IBOutlet, creating the ARSCNView programmatically and add to view, the app works fine.
Doing the same in Objective-C doesn't produce any crash. Strange?
Any idea?