- 需要包含 Foundation.framework 库,并且将 Status 修改为 Optional。可以解决如下错误:
dyld: Symbol not found: _OBJC_CLASS_$_NSURLQueryItem
Referenced from: /var/mobile/Applications/FBA9455D-41EB-4C64-8965-444B6D8A2CE2/XXXX.app/XXXX
Expected in: /System/Library/Frameworks/Foundation.framework/Foundation
in /var/mobile/Applications/FBA9455D-41EB-4C64-8965-444B6D8A2CE2/XXXX.app/XXXX```
2. UITableView 和 UICollectionView 上添加子视图,子视图使用自动约束导致的崩溃。解决办法:将子视图添加到 cell 中(在 cell 中的视图可以使用自动约束),或者子视图的位置使用 frame 来设置。
崩溃信息:
2016-10-12 18:23:54.880 XXXX[1017:60b] *** Assertion failure in -[UICollectionView layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2903.2/UIView.m:8536
2016-10-12 18:23:54.966 XXXX[1017:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UICollectionView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(0x3028ee8b 0x3a5886c7 0x3028ed5d 0x30c3723f 0x32a145f3 0x3269bf43 0x32697767 0x326975f9 0x3269700d 0x32696e1f 0x32a0c86b 0x30259f71 0x302578ff 0x30257c4b 0x301c2541 0x301c2323 0x34ef92eb 0x32a791e5 0x424188 0x3aa81ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
3.UITableView 的 tableHeaderView 上的子视图不可以使用自动约束,否则赋值给 tableHeaderView 的值不会显示。