Cannot instantiate UIView from nib. "warning: could not load any Objective-C class information"
10,364
Found the solution. It all comes to understanding of how xibs work.
What I did was that I set class for both view and File's Owner and connected all the outlets from the View rather than from the File's owner.
Related videos on Youtube
Comments
-
EBDOKUM over 1 year
I get "could not load any Objective-C class information. This will significantly reduce the quality of type information available." warning in the console while initializing an instance of this class:
@IBDesignable class SystemMessage: UIView{ @IBOutlet weak var lbl_message: UILabel! var view: UIView! override init(frame: CGRect) { super.init(frame: frame) setup() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } func setup(){ view = loadViewFromNib() view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight] addSubview(view) } func loadViewFromNib() -> UIView{ let bundle = NSBundle(forClass: self.dynamicType) let nib = UINib(nibName: "SystemMessage", bundle: bundle) let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView return view } }
Execution stops on line
let view = nib.instantiateWithOwner...
with "Thread 1: EXC_BAD_ACCESS(code=2...)"What could be the possible reason behind this?