Reputation: 116
I am making an iOS application and I have this method that runs in a thread, and i am also calling another method in this method, but at the point of execution of the second method, crashes the application, actually, i want to move to a new view after the second method succesfully executes.
Any help will be appreciated. request for the code may be welcome.
Upvotes: 1
Views: 77
Reputation: 53830
The UI is not thread safe. Hence, you should only update the UI from the main thread.
To force code to run on the main thread, you can use a block like this in a thread or other block:
dispatch_async(dispatch_get_main_queue(), ^{
// Update UI here
});
Upvotes: 1