[iOS开发]使用GCD遇到的问题

原创 2015年11月19日 17:28:45

最近在使用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!

iOS开发过程中遇到的问题总结

总结个人开发过程中遇到的问题,持续更新: 1、官网的speakhere复制拷贝到自己的项目,提示CADebugPrintf.h file not found: select the Target, ...
  • henry85
  • henry85
  • 2013年05月11日 18:25
  • 1967

iOS进阶面试题----多线程

1 多线程是什么  多线程是个复杂的概念,按字面意思是同步完成多项任务,提高了资源的使用效率,从硬件、操作系统、应用软件不同的角度去看,多线程被赋予不同的内涵,对于硬件,现在市面上多数的CPU都是多核...
  • xunyn
  • xunyn
  • 2013年11月08日 17:49
  • 56002

ios开发单例模式——使用GCD实现单例模式 & 非ARC单例模式 &使用GCD和线程锁实现单例模式

使用GCD和线程锁实现单例模式 static dispatch_once_t once; dispatch_once(&once,^{ } @synchronized(sel...
  • sunnyboy9
  • sunnyboy9
  • 2015年04月05日 23:51
  • 8732

iOS开发中关于多线程的问题(NSOperationQueue,NSThread,GCD)

1.多线程的优点和缺点分别是什么? 答:优点:1、将耗时较长的操作(网络请求、图片下载、音频下载、数据库访问等)放在子线程中执行,可以防止主线程的卡死;2、可以发挥多核处理的优势,提升cpu的使用率...
  • X_codeWKH
  • X_codeWKH
  • 2016年04月06日 20:08
  • 1854

iOS开发多线程篇—GCD的基本使用

iOS开发多线程篇—GCD的基本使用 一、主队列介绍 主队列:是和主线程相关联的队列,主队列是GCD自带的一种特殊的串行队列,放在主队列中得任务,都会放到主线程中执行。 提示:如果把...
  • yuanchunzi
  • yuanchunzi
  • 2015年06月05日 16:43
  • 278

iOS开发笔记>> GCD调度组的使用

特点: 调度组中的所有异步任务执行结束后, 会得到统一的通知 使用场景: 监听一组异步任务是否执行结束, 如果执行结束就能得到统一的通知 常规用法:  - (void)gcdDemo1 ...
  • qq_34873211
  • qq_34873211
  • 2016年08月05日 17:30
  • 624

iOS开发多线程篇—GCD的基本使用

iOS开发多线程篇—GCD的基本使用 一、主队列介绍 主队列:是和主线程相关联的队列,主队列是GCD自带的一种特殊的串行队列,放在主队列中得任务,都会放到主线程中执行。 提示...
  • muzhenhua
  • muzhenhua
  • 2015年12月02日 13:20
  • 251

iOS开发之GCD使用总结

iOS开发之GCD使用总结   GCD是iOS的一种底层多线程机制,今天总结一下GCD的常用API和概念,希望对大家的学习起到帮助作用。   GCD队列的概念   在多线程开发当中,...
  • shiningchen322
  • shiningchen322
  • 2015年11月12日 07:24
  • 219

iOS开发—使用GCD实现多线程开发—调度队列组

假设有一个音乐应用,如果要执行多个下载歌曲的任务,这些耗时的任务会被放到多个线程上异步执行,指导全部的歌曲下载完成,弹出一个提示框来通知用户歌曲已下载完成。 针对这个应用场景,可以考虑使用队列组。一个...
  • shichunxue
  • shichunxue
  • 2017年11月10日 22:57
  • 77

iOS开发多线程篇—GCD的基本使用

一、主队列介绍 主队列:是和主线程相关联的队列,主队列是GCD自带的一种特殊的串行队列,放在主队列中得任务,都会放到主线程中执行。 提示:如果把任务放到主队列中进行处理,那么不论处理函数是异步的还...
  • DJ_liu
  • DJ_liu
  • 2016年03月07日 15:36
  • 329
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:[iOS开发]使用GCD遇到的问题
举报原因:
原因补充:

(最多只允许输入30个字)