gpt4 book ai didi

ipad - CATiledLayer drawLayer :inContext: crashing when the view is deallocated while the image to draw is being retrieved

转载 作者:行者123 更新时间:2023-12-03 17:46:40 29 4
gpt4 key购买 nike

当我的 CATiledLayer 正在检索图像以在后台线程中绘制时,当我的 ViewController 被释放时,我的应用程序崩溃了。我收到一条消息

-[MyViewController respondsToSelector:]: message sent to deallocated instance 0x8f58e00

并且调试器显示
0 ___forwarding___
1 __forwarding_prep_0__
2 -[CATiledLayer(CATiledLayerPrivate) canDrawRect:levelOfDetail:]
3 tiled_layer_render
4 CAImageProviderThread
5 CAImageProviderBackgroundThread
6 CA::DispatchGroup::thread
7 thread_fun
8 _pthread_start

现在,我确实想释放 MyViewController 的某个实例,因为我不再需要它了。但是当它从后台线程返回时,如何阻止它崩溃呢?

最佳答案

解决了。在解除分配 MyViewController 时,我应该将 CATiledLayer 的委托(delegate)设置为 nil。从现在开始,我会记得为代表们这样做。

关于ipad - CATiledLayer drawLayer :inContext: crashing when the view is deallocated while the image to draw is being retrieved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3656011/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com