Threads in native extensions (IOS)


#1

I’m developing a native SDK, and have hit a roadblock.

I have our sdk running on iPhone build (on a separate thread), communicating with our backend that delivers HTML-formatted content dynamically. All the client-server stuff is fine.

I can open a WKWebView from my native extension when called from the game engine, insert some sample HTML, add it to the native iOS UIView as returned by dmGraphics, and it displays on screen fine.

When I call the exact same code with the exact same HTML content from our background thread, nothing gets displayed.

Anyone got any bright ideas?


#2

Normally (in any UI related app), you should only do UI stuff on the designated UI thread. That thread is usually the main thread (but it can vary). Could that be it?


#3

That’s what we were thinking. But there’s a difference between should and must :wink:

I’LL try to pump the queue from the main thread instead and see what happens there.