how to deal with the iOS multithreading done inside some wrapped objective C code ?

I’m using the code from the TWReverseAuth example https://github.com/seancook/TWReverseAuthExample, in my cocosd2-x project by wrapping it in c++ and by removing the interface.

it’s basically the same code (that is working in the example) but it’s now coring and it seems to come from the threading done inside the objective C .

cores are very random and are differents if i modify the “dispatch_async(dispatch_get_main_queue())” and
“dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)” fonctions.

How to deal with multithreading inside objectice C, when you integrate it inside cocos2d-x ?