I am using the iAd suite with storyboards from Apple, as per this link... Apple iAd Storyboard documentation
It all works fine until I turn autolayout on. It builds fine but crashes on running. The output I get is:
2013-08-24 12:06:36.138 TabbedBanner[7272:c07] * Assertion failure in -[UIView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5781 2013-08-24 12:06:36.139 TabbedBanner[7272:c07] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after sending -viewDidLayoutSubviews to the view controller. BannerViewController's implementation needs to send -layoutSubviews to the view to invoke auto layout.' *** First throw call stack: (0x1e27012 0x110ee7e 0x1e26e78 0xba4665 0xa347a 0x11226b0 0x1358fc0 0x134d33c 0x1358eaf 0x1422bd 0x8ab56 0x8966f 0x89589 0x887e4 0x883ef 0x65c9d 0x5098b 0x5194b 0x62cb5 0x63beb 0x55698 0x1700df9 0x1700ad0 0x1d9cbf5 0x1d9c962 0x1dcdbb6 0x1dccf44 0x1dcce1b 0x5117a 0x52ffc 0x2a0d 0x2935) libc++abi.dylib: terminate called throwing an exception (lldb)
I know it is something to do with the subviews in storyboard but I dont know how to correct this error. I am pretty new to iOS and trying to teach myself so any help is appreciated. Many Thanks
Add:
[self.view layoutIfNeeded];
to the end of this method
- (void)viewDidLayoutSubviews
inside your BannerViewController
来源:https://stackoverflow.com/questions/18429728/autolayout-and-subviews