-3

Need help with the syntax when the method being passed into @selector has arguments. Thanks!

//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];
  });
4

2 に答える 2

3

ヒント:「withObject:」の部分があるのはそのためです。

ヒント2:Appleには、フレームワークに関するかなり優れたドキュメントがあります。

ヒント3:

[self performSelectorOnMainThread:@selector(hydrateListForCategory:) withObject:self.categorySelected waitUntilDone:YES];
于 2012-08-14T17:37:33.880 に答える
1
[self performSelectorOnMainThread:@selector(hydrateListForCategory:) withObject:self.categorySelected waitUntilDone:YES];
于 2012-08-14T17:37:30.957 に答える