UI changes on background thread due to NSUserDefaultsDidChangeNotification

后端 未结 1 1188
忘了有多久
忘了有多久 2021-01-03 16:12

I am debugging an issue that occasionally causes my app to crash with a WebTryThreadLock message in the crash report. It looks like the app is crashing because

相关标签:
1条回答
  • 2021-01-03 17:03

    You should send a message to the UI thread's dispatch queue and do your UI modifications from there.

    Like this:

    dispatch_async(dispatch_get_main_queue(), ^{
      // your code here
    });
    

    See Apple's Grand Central Dispatch documentation

    --- Dave

    0 讨论(0)
提交回复
热议问题