Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autolayout issue Xcode 8 [_SwiftValue nsli_superitem]

Tags:

Converting my code to Swift 3 I found a weird issue. Right now (15th September 2016) Xcode 8 (public version) is out, and after converting the code, my App crashes without an apparently reason.

There is something wrong with Auto Layout and the log says something like:

[_SwiftValue nsli_superitem]: unrecognized selector sent to instance  

How can I solve? Thanks

like image 965
pascalbros Avatar asked Sep 15 '16 21:09

pascalbros


1 Answers

Just figured out the weird but working solution:

Instead of doing this:

let views = ["view":aView] view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "...", options:[], metrics: metrics, views: views)) 

Declare the dictionary explicitly:

let views: [String:UIView] = ["view":aView] view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "...", options:[], metrics: metrics, views: views)) 

I know, it's weird but it works. Cheers

like image 110
pascalbros Avatar answered Oct 04 '22 14:10

pascalbros