iPhone中的performSelectorOnMainThread问题 [英] problem in performSelectorOnMainThread in iphone

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

问题描述

我这样做了


[(OfficeLinQViewController*)sharedManager.m_o  performSelectorOnMainThread:@selector(findLocalListing::)
                                                               withObject:(folderList,path) 
                                                            waitUntilDone:NO];

但是问题在于,在findLocalListing函数中,两个参数路径都保存而不是folderList.

but the problem is that in findLocalListing function in both the arguments path is saved not folderList.

推荐答案

再次查看withObject:部分.它说的是withObject,而不是withObjects.您只能将一个参数传递给选择器.

Look again at the withObject: part. It says withObject, not withObjects. You can only pass one argument to the selector.

我通常用这样的包装方法解决这些问题.

I usually solve these problems with a wrapper method like this.

[(OfficeLinQViewController*)sharedManager.m_o performSelectorOnMainThread:@selector(findLocalListingWithArgumentArray:)withObject:[NSArray arrayWithObjects:folderList,path, nil] waitUntilDone:NO];

- (void)findLocalListingWithArgumentArray:(NSArray *)argArray {
    [self findLocalListing:[argArray objectAtIndex:0] inPath:[argArray objectAtIndex:1]];
}

哦,您应该将findLocalListing ::重命名为有用的名称.

Oh, and you should rename findLocalListing:: to something useful.

这篇关于iPhone中的performSelectorOnMainThread问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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