是否可以使用此方法並傳遞一個對象?有了這個代碼,我得到這個錯誤:iOS performSelector onThread with object
-[myApp hideUpdateView]: unrecognized selector sent to instance 0x8b6a880
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myApp hideUpdateView]: unrecognized selector sent to instance 0x8b6a880'
它從來沒有達到hideUpdateView方法...
代碼:
NSArray *array = [NSArray arrayWithObjects:@"1", @"2", nil];
[self performSelector:@selector(hideUpdateView) onThread:[NSThread mainThread] withObject:array waitUntilDone:YES];
- (void) hideUpdateView: (NSArray *) inputArray
{
int catCount = [[inputArray objectAtIndex:0] intValue];
//hide it
}
我一直在iOS開發一段時間,但它應該是'@selector(hideUpdateView :) '? – Pete
@Pete當然應該。 – 2012-09-18 18:57:20
@ H2CO3涼爽。而且我還沒有在2年內寫出一行Obj-C。我應該把它作爲回答,而不是賺取積分。 – Pete