检测performSelectorInBackground的结束:withObject: [英] Detect end of performSelectorInBackground:withObject:

查看:101
本文介绍了检测performSelectorInBackground的结束:withObject:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用程序中有异步服务器请求:

I have an asynchronous server request in my iOS app:

[self performSelectorInBackground:@selector(doSomething) withObject:nil];

如何检测此操作的结束?

How can I detect the end of this operation?

推荐答案

在doSomething方法结束时拨打电话?!

Put a call at the end of the doSomething method?!

- (void)doSomething {
    // Thread starts here

    // Do something

    // Thread ends here
    [self performSelectorOnMainThread:@selector(doSomethingDone) withObject:nil waitUntilDone:NO];
}

这篇关于检测performSelectorInBackground的结束:withObject:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆