最近在项目中遇到一个偶发的闪退
闪退日志如下:
A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs.
乘数为0或零秒的项与第一个属性的位置一起创建非法的位置约束,该位置等于常量。位置属性必须成对指定。
NSLayoutConstraint for <BDForestPowerView: 0x11bef8830; frame = (0 0; 320 622); autoresize = W+H; gestureRecognizers = <NSArray: 0x28050d710>; layer = <CALayer: 0x280b875e0>>: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs.
2(null)
3((
4 0 CoreFoundation 0x0000000189905668 E2D6A76B-6879-31A3-8168-DF49F94E17CD + 1222248
5 1 libobjc.A.dylib 0x0000000189627bcc objc_exception_throw + 56
6 2 Foundation 0x0000000189df9d54 EEBCBA18-269A-351C-BCE0-D23E156923D4 + 2305364
7 3 Foundation 0x0000000189becb9c EEBCBA18-269A-351C-BCE0-D23E156923D4 + 154524
8 4 Masonry 0x00000001040fbd74 -[MASViewConstraint install] + 808
9 5 Masonry 0x00000001040f7bc0 -[MASCompositeConstraint install] + 232
10 6 Masonry 0x00000001040f9850 -[MASConstraintMaker install] + 552
11 7 Masonry 0x00000001040fefb8 -[UIView(MASAdditions) mas_makeConstraints:] + 128
12 8 TRGFShop-Test 0x0000000102586774 TRGFShop-Test + 1189748
13 9 TRGFShop-Test 0x0000000102583a4c TRGFShop-Test + 1178188
14 10 TRGFShop-Test 0x0000000102509598 TRGFShop-Test + 677272
15 11 TRGFShop-Test 0x00000001028f3f28 TRGFShop-Test + 4783912
16 12 TRGFShop-Test 0x00000001028f2d40 TRGFShop-Test + 4779328
17 13 AFNetworking 0x00000001036de878 __124-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:headers:uploadProgress:downloadProgress:success:failure:]_block_invoke_2 + 116
18 14 AFNetworking 0x00000001036f0570 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.108 + 148
19 15 libdispatch.dylib 0x00000001895ca9a8 361DA09A-E7CE-30EB-8DFC-9D9AF9DE4A0A + 371112
20 16 libdispatch.dylib 0x00000001895cb524 361DA09A-E7CE-30EB-8DFC-9D9AF9DE4A0A + 374052
21 17 libdispatch.dylib 0x000000018957d640 361DA09A-E7CE-30EB-8DFC-9D9AF9DE4A0A + 54848
22 18 CoreFoundation 0x00000001898836bc E2D6A76B-6879-31A3-8168-DF49F94E17CD + 689852
23 19 CoreFoundation 0x000000018987e590 E2D6A76B-6879-31A3-8168-DF49F94E17CD + 669072
24 20 CoreFoundation 0x000000018987dba8 CFRunLoopRunSpecific + 424
25 21 GraphicsServices 0x00000001939ed344 GSEventRunModal + 160
26 22 UIKitCore 0x000000018d9b93e4 UIApplicationMain + 1932
27 23 TRGFShop-Test 0x000000010248dd14 TRGFShop-Test + 171284
28 24 libdyld.dylib 0x00000001897058f0 0CB11832-70AD-3EC6-A191-AFB85E3BF348 + 6384
29)
30
31dSYM UUID: 266C98ED-A074-3C31-9D19-B6771D4AA632
32CPU Type: arm64
33Slide Address: 0x0000000100000000
34Binary Image: TRGFShop-Test
35Base Address: 0x0000000102464000
约束.png
引起此问题的关键是 View左右绑定的约束不是成对的
左边的约束绑定的Superview,右边的绑定的是safe Area
所以导致闪退。
网友评论