谨慎管理调试日志

    开发人员应考虑调试日志在生产环境中可能出现的风险。 一般来说,我们建议他们在生产中禁用。

    在Android中,还可以利用ProGuard或DexGuard完全删除发布版本中Log类的方法调用,从而取消对Log.d,Log.i,Log.v,Log.e方法的所有调用。

    在iOS上禁用NSLog语句将删除可能被拦截的潜在敏感信息,因为额外的好处可能会稍微提高应用程序的性能。 例如,一种方法是在生产构建中定义NSLog:

    1. This macro effectively removes all NSLog statements and replaces it with empty text at compilation time.
    2. > NSLog(@”Breakpoint here with data %@”,data.description);
    3. > ;