On the iOS7 system, I wrote a cinemamemberview in the project, added to a viewcontroller, and the result crashed. IOS8 and IOS6 will not crash.
Terminating app due to uncaught exception ' nsinternalinconsistencyexception ', Reason: ' Auto Layout still required after ex Ecuting-layoutsubviews. Cinemamemberview ' simplementation of-layoutsubviews needs to call super. '
First throw Call stack:
(
0 corefoundation 0x073cf1e4 __exceptionpreprocess + 180
1 LIBOBJC. A.dylib 0x070848e5 Objc_exception_throw + 44
2 corefoundation 0x073cf048 +[nsexception raise:format:arguments:] + 136
3 Foundation 0x04fc54de-[nsassertionhandler handlefailureinmethod:object:file:linenumber:d Escription:] + 116
4 UIKit 0x05466a38-[uiview (calayerdelegate) Layoutsublayersoflayer:] + 567
5 LIBOBJC. A.dylib 0x0709682b-[nsobject Performselector:withobject:] + 70
6 Quartzcore 0x06df545a-[calayer Layoutsublayers] + 148
7 Quartzcore 0x06de9244 _zn2ca5layer16layout_if_neededepns_11transactione + 380
8 Quartzcore 0x06de90b0 _zn2ca5layer28layout_and_display_if_neededepns_11transactione + 26
9 Quartzcore 0x06d4f7fa _zn2ca7context18commit_transactionepns_11transactione + 294
Ten Quartzcore 0x06d50b85 _zn2ca11transaction6commitev + 393
One quartzcore 0x06e0e5b0 +[catransaction flush] + 52
UIKit 0x05414ce5 _aftercacommithandler + 131
Corefoundation 0x0739736e __cfrunloop_is_calling_out_to_an_observer_callback_function__ + 30
Corefoundation 0X073972BF __cfrunloopdoobservers + 399
Corefoundation 0x07375254 __cfrunlooprun + 1076
Corefoundation 0x073749d3 cfrunlooprunspecific + 467
Corefoundation 0x073747eb Cfrunloopruninmode + 123
Graphicsservices 0x0906d5ee Gseventrunmodal + 192
Graphicsservices 0x0906d42b Gseventrun + 104
UIKit 0x053f7f9b Uiapplicationmain + 1225
Sohuvideohd 0x0000d649 main + 121
Libdyld.dylib 0x0805a6d9 start + 1
??? 0x00000001 0x0 + 1
)
The layoutsubviews of Cinemamemberview is this:
-(void) layoutsubviews{ [Super layoutsubviews]; if (Self.layouttype = = Ecinemaviewtype_wide_button) { [self layoutwidetype]; [Self Layoutwidetypeonlybutton]; } else if (Self.layouttype = = Ecinemaviewtype_wide_logo) { [self layoutwidetype]; [Self Layoutwidetypeonlylogo]; } else { [self layoutnarrowtype];} }
The solution is to put Super layoutsubviews at the end of Layoutsubviews, the problem is solved, but the cause of the real crash is unclear.
-(void) layoutsubviews{/ * Logic code */ ... /* Logic code */ [super Layoutsubviews];}
Refer here
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"Auto Layout still required after Executing-layoutsubviews" iOS7 Crash SDK defect