小编Wou*_*r A的帖子

Objective-c使用线程原因:target没有实现选择器

由于我是ObjC的新手,我坚持以下问题:

我有一个函数downloadFile

-(void) downloadFile:(NSMutableArray*)paramArray withDict:(NSMutableDictionary*)options      
{
    //do stuff
}
Run Code Online (Sandbox Code Playgroud)

我想以线程开头,因此我使用这行代码:

NSThread* dLoad = [[NSThread alloc] initWithTarget:self selector:@selector(downloadFile:) object:nil];
[dLoad start];  
Run Code Online (Sandbox Code Playgroud)

它抛出以下错误:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[LaunchDownload downloadFile:])'
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?

objective-c

6
推荐指数
1
解决办法
6324
查看次数

标签 统计

objective-c ×1