Detecting if iOS app is run in debugger

前端 未结 8 1851
北恋
北恋 2020-11-27 13:45

I set up my application to either send debugging output to console or a log file. Now, I\'d like to decide with in the code whether

  • it is run in the debugger
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 14:22

    The simplest solution actually is

    _isDebugging = isatty(STDERR_FILENO);
    

    It isn't exactly the same as telling whether the app is running under debugger, but good enough (even better?) to determine whether the log should be written to disk.

提交回复
热议问题