美文网首页selector
ios #pragma clang diagnostic

ios #pragma clang diagnostic

作者: 俊俊吖 | 来源:发表于2017-07-03 14:23 被阅读28次

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-相关命令"

    //需要操作的代码
    

    pragma clang diagnostic pop

    1:忽略弃用的警告⚠️
    //方法弃用告警

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-Wdeprecated-declarations"

    UIAlertView *alertViewTmp = [[UIAlertView alloc]initWithTitle:@"" message:@"" delegate:nil cancelButtonTitle:@"" otherButtonTitles:@"", nil];
    [alertViewTmp show];
    

    pragma clang diagnostic pop

    2:忽略不兼容指针类型⚠️
    // 不兼容指针类型

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-Wincompatible-pointer-types"

    //
    

    pragma clang diagnostic pop

    3:循环引用⚠️
    break the retain cycle.

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-Warc-retain-cycles"

    // self.completionBlock = ^ {
    // ...
    // };

    pragma clang diagnostic pop

    4:未使用变量⚠
    // 未使用变量

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-Wunused-variable"

    int a;
    

    pragma clang diagnostic pop

    5.未使用默认⚠️

    pragma clang diagnostic push

    pragma clang diagnostic ignored "-Wcovered-switch-default"

    // switch (style) {
    // case UITableViewCellStyleDefault:
    // case UITableViewCellStyleValue1:
    // case UITableViewCellStyleValue2:
    // case UITableViewCellStyleSubtitle:
    // // ...
    // default:
    // return;
    // }

    pragma clang diagnostic pop

    相关文章

      网友评论

        本文标题:ios #pragma clang diagnostic

        本文链接:https://www.haomeiwen.com/subject/cxsicxtx.html