How to log a warning that shows up as a runtime issue in Xcode?

前端 未结 6 1416
粉色の甜心
粉色の甜心 2021-01-01 11:32

Xcode 8 or 9 started displaying runtime issues. You see a purple icon at the top of the window, and a list in Issue Navigator, next to buildtime issues like compilation warn

6条回答
  •  梦毁少年i
    2021-01-01 11:52

    It depends on you if you are doing any UI related stuff on other then main thread so system will generate for you else you can not manually generate it.

    All UI manipulations should be done in the Main Thread.

    If you are not doing this so, in XCode 9 have feature called Main thread checker.

    For more info, you can visit below url: https://developer.apple.com/documentation/code_diagnostics/main_thread_checker

    It is basically used to checks whether any UIKit related stuff is happening on a main thread or not ?, If failed to do so, it will produce issues at Runtime. So wrap your code in Main Thread block like below to avoid glitches and runtime warnings.

    You can Enable - Disable using this steps Edit Scheme... -> (Select your scheme) -> Diagnostics -> Disable 'Main thread checker'

提交回复
热议问题