最近在使用GCD遇到这样的问题,刚开始不是很明白,不能使用后台线程来修改autolayout引擎?后来查了一下问题,在iOS9 - This application is modifying the autolayout engine from a background thread — where?这里找到了答案,想起之前看过一篇文章详细论述GCD的提到修改UI的操作应该放在主线程中,因为iOS的设计就是用主线程来加载渲染界面的,因此恍然大悟,感觉实践才能检验真理呀!
2015-11-19 17:14:25.825 VRPVisual[8917:2969207] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x0000000183578f60 <redacted> + 148
1 libobjc.A.dylib 0x00000001980c7f80 objc_exception_throw + 56
2 CoreFoundation 0x0000000183578e90 <redacted> + 0
3 Foundation 0x00000001845972d8 <redacted> + 88
4 Foundation 0x00000001844194fc <redacted> + 36
5 UIKit 0x000000018936f108 <redacted> + 884
6 UIKit 0x000000018937057c <redacted> + 788
7 UIKit 0x000000018943f740 <redacted> + 480
8 UIKit 0x000000018943c708 <redacted> + 172
9 UIKit 0x000000018943c978 <redacted> + 96
10 UIKit 0x000000018943ce3c <redacted> + 80
11 UIKit 0x00000001894413d0 <redacted> + 492
12 UIKit 0x000000018944053c <redacted> + 148
13 UIKit 0x000000018944047c <redacted> + 284
14 UIKit 0x0000000188f70d40 <redacted> + 444
15 UIKit 0x0000000188f70e14 <redacted> + 60
16 UIKit 0x0000000188f70f54 <redacted> + 28
17 UIKit 0x0000000188f70504 <redacted> + 100
18 UIKit 0x0000000188b0c098 <redacted> + 996
19 UIKit 0x0000000188b0bc9c <redacted> + 28
20 UIKit 0x0000000188e8b184 <redacted> + 108
21 UIKit 0x0000000188e842d4 <redacted> + 1328
22 UIKit 0x0000000188e85d94 <redacted> + 4644
23 UIKit 0x0000000188e88800 <redacted> + 472
24 UIKit 0x0000000188c05ea0 <redacted> + 184
25 UIKit 0x000000018942e880 <redacted> + 512
26 UIKit 0x000000018942ce34 <redacted> + 228
27 UIKit 0x0000000188f8081c <redacted> + 260
28 VRPVisual 0x000000010002c704 __48-[ExportViewController requestToExportInstance:]_block_invoke176 + 2760
29 VRPVisual 0x0000000100029a94 __86-[BMKRouteSearch(BatchRouteSearch) drivingRouteMatrixSearch:successBlock:failedBlock:]_block_invoke_3 + 592
30 libdispatch.dylib 0x00000001007a9ca8 _dispatch_call_block_and_release + 24
31 libdispatch.dylib 0x00000001007a9c68 _dispatch_client_callout + 16
32 libdispatch.dylib 0x00000001007b8ec8 _dispatch_root_queue_drain + 2344
33 libdispatch.dylib 0x00000001007b8590 _dispatch_worker_thread3 + 132
34 libsystem_pthread.dylib 0x0000000198af9470 _pthread_wqthread + 1092
35 libsystem_pthread.dylib 0x0000000198af9020 start_wqthread + 4
)
2015-11-19 17:14:25.841 VRPVisual[8917:2969207] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x0000000183578f60 <redacted> + 148
1 libobjc.A.dylib 0x00000001980c7f80 objc_exception_throw + 56
2 CoreFoundation 0x0000000183578e90 <redacted> + 0
3 Foundation 0x00000001845972d8 <redacted> + 88
4 Foundation 0x000000018441da1c <redacted> + 56
5 Foundation 0x00000001844195dc <redacted> + 260
6 UIKit 0x000000018936f108 <redacted> + 884
7 UIKit 0x000000018937057c <redacted> + 788
8 UIKit 0x000000018943f740 <redacted> + 480
9 UIKit 0x000000018943c708 <redacted> + 172
10 UIKit 0x000000018943c978 <redacted> + 96
11 UIKit 0x000000018943ce3c <redacted> + 80
12 UIKit 0x00000001894413d0 <redacted> + 492
13 UIKit 0x000000018944053c <redacted> + 148
14 UIKit 0x000000018944047c <redacted> + 284
15 UIKit 0x0000000188f70d40 <redacted> + 444
16 UIKit 0x0000000188f70e14 <redacted> + 60
17 UIKit 0x0000000188f70f54 <redacted> + 28
18 UIKit 0x0000000188f70504 <redacted> + 100
19 UIKit 0x0000000188b0c098 <redacted> + 996
20 UIKit 0x0000000188b0bc9c <redacted> + 28
21 UIKit 0x0000000188e8b184 <redacted> + 108
22 UIKit 0x0000000188e842d4 <redacted> + 1328
23 UIKit 0x0000000188e85d94 <redacted> + 4644
24 UIKit 0x0000000188e88800 <redacted> + 472
25 UIKit 0x0000000188c05ea0 <redacted> + 184
26 UIKit 0x000000018942e880 <redacted> + 512
27 UIKit 0x000000018942ce34 <redacted> + 228
28 UIKit 0x0000000188f8081c <redacted> + 260
29 VRPVisual 0x000000010002c704 __48-[ExportViewController requestToExportInstance:]_block_invoke176 + 2760
30 VRPVisual 0x0000000100029a94 __86-[BMKRouteSearch(BatchRouteSearch) drivingRouteMatrixSearch:successBlock:failedBlock:]_block_invoke_3 + 592
31 libdispatch.dylib 0x00000001007a9ca8 _dispatch_call_block_and_release + 24
32 libdispatch.dylib 0x00000001007a9c68 _dispatch_client_callout + 16
33 libdispatch.dylib 0x00000001007b8ec8 _dispatch_root_queue_drain + 2344
34 libdispatch.dylib 0x00000001007b8590 _dispatch_worker_thread3 + 132
35 libsystem_pthread.dylib 0x0000000198af9470 _pthread_wqthread + 1092
36 libsystem_pthread.dylib 0x0000000198af9020 start_wqthread + 4
)
2015-11-19 17:14:25.853 VRPVisual[8917:2969207] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x0000000183578f60 <redacted> + 148
1 libobjc.A.dylib 0x00000001980c7f80 objc_exception_throw + 56
2 CoreFoundation 0x0000000183578e90 <redacted> + 0
3 Foundation 0x00000001845972d8 <redacted> + 88
4 Foundation 0x00000001844194fc <redacted> + 36
5 UIKit 0x000000018936f158 <redacted> + 964
6 UIKit 0x000000018937057c <redacted> + 788
7 UIKit 0x000000018943f740 <redacted> + 480
8 UIKit 0x000000018943c708 <redacted> + 172
9 UIKit 0x000000018943c978 <redacted> + 96
10 UIKit 0x000000018943ce3c <redacted> + 80
11 UIKit 0x00000001894413d0 <redacted> + 492
12 UIKit 0x000000018944053c <redacted> + 148
13 UIKit 0x000000018944047c <redacted> + 284
14 UIKit 0x0000000188f70d40 <redacted> + 444
15 UIKit 0x0000000188f70e14 <redacted> + 60
16 UIKit 0x0000000188f70f54 <redacted> + 28
17 UIKit 0x0000000188f70504 <redacted> + 100
18 UIKit 0x0000000188b0c098 <redacted> + 996
19 UIKit 0x0000000188b0bc9c <redacted> + 28
20 UIKit 0x0000000188e8b184 <redacted> + 108
21 UIKit 0x0000000188e842d4 <redacted> + 1328
22 UIKit 0x0000000188e85d94 <redacted> + 4644
23 UIKit 0x0000000188e88800 <redacted> + 472
24 UIKit 0x0000000188c05ea0 <redacted> + 184
25 UIKit 0x000000018942e880 <redacted> + 512
26 UIKit 0x000000018942ce34 <redacted> + 228
27 UIKit 0x0000000188f8081c <redacted> + 260
28 VRPVisual 0x000000010002c704 __48-[ExportViewController requestToExportInstance:]_block_invoke176 + 2760
29 VRPVisual 0x0000000100029a94 __86-[BMKRouteSearch(BatchRouteSearch) drivingRouteMatrixSearch:successBlock:failedBlock:]_block_invoke_3 + 592
30 libdispatch.dylib 0x00000001007a9ca8 _dispatch_call_block_and_release + 24
31 libdispatch.dylib 0x00000001007a9c68 _dispatch_client_callout + 16
32 libdispatch.dylib 0x00000001007b8ec8 _dispatch_root_queue_drain + 2344
33 libdispatch.dylib 0x00000001007b8590 _dispatch_worker_thread3 + 132
34 libsystem_pthread.dylib 0x0000000198af9470 _pthread_wqthread + 1092
35 libsystem_pthread.dylib 0x0000000198af9020 start_wqthread + 4
)
2015-11-19 17:14:25.863 VRPVisual[8917:2969207] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x0000000183578f60 <redacted> + 148
1 libobjc.A.dylib 0x00000001980c7f80 objc_exception_throw + 56
2 CoreFoundation 0x0000000183578e90 <redacted> + 0
3 Foundation 0x00000001845972d8 <redacted> + 88
4 Foundation 0x000000018441da1c <redacted> + 56
5 Foundation 0x00000001844195dc <redacted> + 260
6 UIKit 0x000000018936f158 <redacted> + 964
7 UIKit 0x000000018937057c <redacted> + 788
8 UIKit 0x000000018943f740 <redacted> + 480
9 UIKit 0x000000018943c708 <redacted> + 172
10 UIKit 0x000000018943c978 <redacted> + 96
11 UIKit 0x000000018943ce3c <redacted> + 80
12 UIKit 0x00000001894413d0 <redacted> + 492
13 UIKit 0x000000018944053c <redacted> + 148
14 UIKit 0x000000018944047c <redacted> + 284
15 UIKit 0x0000000188f70d40 <redacted> + 444
16 UIKit 0x0000000188f70e14 <redacted> + 60
17 UIKit 0x0000000188f70f54 <redacted> + 28
18 UIKit 0x0000000188f70504 <redacted> + 100
19 UIKit 0x0000000188b0c098 <redacted> + 996
20 UIKit 0x0000000188b0bc9c <redacted> + 28
21 UIKit 0x0000000188e8b184 <redacted> + 108
22 UIKit 0x0000000188e842d4 <redacted> + 1328
23 UIKit 0x0000000188e85d94 <redacted> + 4644
24 UIKit 0x0000000188e88800 <redacted> + 472
25 UIKit 0x0000000188c05ea0 <redacted> + 184
26 UIKit 0x000000018942e880 <redacted> + 512
27 UIKit 0x000000018942ce34 <redacted> + 228
28 UIKit 0x0000000188f8081c <redacted> + 260
29 VRPVisual 0x000000010002c704 __48-[ExportViewController requestToExportInstance:]_block_invoke176 + 2760
30 VRPVisual 0x0000000100029a94 __86-[BMKRouteSearch(BatchRouteSearch) drivingRouteMatrixSearch:successBlock:failedBlock:]_block_invoke_3 + 592
31 libdispatch.dylib 0x00000001007a9ca8 _dispatch_call_block_and_release + 24
32 libdispatch.dylib 0x00000001007a9c68 _dispatch_client_callout + 16
33 libdispatch.dylib 0x00000001007b8ec8 _dispatch_root_queue_drain + 2344
34 libdispatch.dylib 0x00000001007b8590 _dispatch_worker_thread3 + 132
35 libsystem_pthread.dylib 0x0000000198af9470 _pthread_wqthread + 1092
36 libsystem_pthread.dylib 0x0000000198af9020 start_wqthread + 4
)
2015-11-19 17:14:25.986 VRPVisual[8917:2969022] <CATransformLayer: 0x13e113b70> - changing property masksToBounds in transform-only layer, will have no effect
2015-11-19 17:14:25.987 VRPVisual[8917:2969022] <CATransformLayer: 0x13ea49a80> - changing property masksToBounds in transform-only layer, will have no effect
2015-11-19 17:14:25.988 VRPVisual[8917:2969022] <CATransformLayer: 0x13ec251c0> - changing property masksToBounds in transform-only layer, will have no effect
2015-11-19 17:14:53.980 VRPVisual[8917:2969022] Warning: Attempt to present <MFMailComposeViewController: 0x136c4f200> on <ExportViewController: 0x13a23e960> whose view is not in the window hierarchy!