【问题标题】:NSOperation fails when switching the tab bar切换标签栏时NSOperation失败
【发布时间】:2013-01-16 09:12:00
【问题描述】:

我正在使用带有两个标签的TabBarController。第二个我调用NSOperation,将操作添加到NSOperationQueue。当我选择第二个选项卡时,我已经在主线程上调用了这个操作。但是当我切换到第一个选项卡时,应用程序崩溃了。我正在正确释放和取消操作

我收到以下关于 bt 的消息

#0  0x0243d09b in objc_msgSend ()
#1  0x1299c4a0 in ?? ()
#2  0x008b6d23 in -[__NSOperationInternal start] ()
#3  0x008b6a34 in -[NSOperation start] ()
#4  0x00943301 in __block_global_6 ()
#5  0x0222753f in _dispatch_call_block_and_release ()
#6  0x02239014 in _dispatch_client_callout ()
#7  0x0222a2e8 in _dispatch_root_queue_drain ()
#8  0x02229fcb in _dispatch_worker_thread3 ()
#9  0x99a16b24 in _pthread_wqthread ()
#10 0x99a186fe in start_wqthread ()

请提出任何解决方案

【问题讨论】:

    标签: iphone objective-c nsthread nsoperation nsoperationqueue


    【解决方案1】:

    确保确定 NSOperationQueue 的所有权。另外,请确保在切换选项卡时不会释放 NSOperation 所需的所有实例。

    能否请您显示正在执行实际工作的线程的堆栈跟踪?

    【讨论】:

    • 这是我的错误,我没有在 viewDidDisappear 中取消 viewwillDisappear 中的操作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 2012-10-09
    • 2017-12-23
    • 1970-01-01
    • 2015-09-08
    相关资源
    最近更新 更多