iOS去除api过期警告提示

1、问题描述

  • 应用最低支持版本调高,导致部分旧的代码中API出现警告。

2、解决问题

  • 使用以下代码夹住过期的API部分代码即可解决该问题。
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    // 这部分使用到的过期api
    
#pragma clang diagnostic pop
  • 实现了过期的方法可用以下这个
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"

#pragma clang diagnostic pop
原文地址:https://www.cnblogs.com/CH520/p/10668261.html