Erstellen einer Ansicht auf einem Hintergrundthread, Hinzufügen der Hauptansicht auf dem Hauptthread
Ich bin neu in Ziel C und komme aus .NET und Java Hintergrund.
Ich muss also einige UIwebviews asynchron erstellen, dies mache ich in meiner eigenen Warteschlange mit
dispatch_queue_t queue = dispatch_queue_create("myqueue", NULL);
dispatch_async(queue, ^{
// create UIwebview, other things too
[self.view addSubview:webView];
});
Wie Sie sich vorstellen können, löst dies einen Fehler aus:
bool _WebTryThreadLock(bool), 0xa1b8d70: Tried to obtain the web lock from a thread other
than the main thread or the web thread. This may be a result of calling to UIKit from a
secondary thread. Crashing now...
Wie kann ich die Unteransicht zum Hauptthread hinzufügen?