[performSelector:withObject:afterDelay:] for calling C++ functions?

We can’t use C++ functions as selectors in .mm files as I talked before. We can use another way to implement the delay call:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
   // your C++ code here

It would call your C++ code after 5 seconds delay. Still block tricks.

Published by


This is Vivo. Yes, I'm Vivo.

Leave a Reply

Your email address will not be published. Required fields are marked *