苦苦挣扎,传递多个参数来执行SelectorInBackground方法

Jac*_*ins 1 iphone parameters objective-c selector

我从早期的Stack Overflow问题中找到了这段代码,该问题描述了如何将多个参数传递给performSelectorInBackground方法.

但是我很难将代码应用到我的问题中,这是我的代码:

- (void)callingMethod {
    NSDictionary * args = [NSDictionary dictionaryWithObjectsAndKeys:
                           cell, @"cell",
                           storyIndex, @"storyIndex",
                           nil];
    [self performSelectorInBackground:@selector(setCellImageWrapper:)
                           withObject:args];
}

- (void)setCellImageWrapper:(NSDictionary *)args {
    [self setCellImage:[[args objectForKey:@"cell"]]
             withIndex:[[args objectForKey:@"storyIndex"] intValue]];
}

- (void) setCellImage: (EventTableCell *)cell withIndex:(int)storyIndex {

    //My Code

}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我正在尝试将类型为EventTableCell的对象从setCellImageWrapper方法传递给setCellImage方法.当我尝试调用setCellImage -withIndex方法时,我收到错误"Expected Identifier".谁能告诉我我做错了什么?

谢谢,

插口

dre*_*wag 5

如果你删除周围的额外括号

[args objectForKey:@"cell"]
Run Code Online (Sandbox Code Playgroud)

它应该编译好