-3
@selector로 전달되는 메서드에 인수가있는 경우 구문에 도움이 필요합니다. 감사!Objective-C performSelectorOnMainThread의 인수를 사용하여 메시지 전달 :
//This works
dispatch_async(kBgQueue, ^{
[self performSelectorOnMainThread:@selector(hydrateList) withObject:nil waitUntilDone:YES];
});
//But what about when the method in the selector has arguments?
//This is incorrect, syntactically
dispatch_async(kBgQueue, ^{
[self performSelectorOnMainThread:@selector(hydrateListForCategory:self.categorySelected) withObject:nil waitUntilDone:YES];
});
그 방법에 대한 검색 및 문서를 참조하십시오. [NSObject documentation] (https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/performSelectorOnMainThread:withObject : waitUntilDone :) – MechEthan