升级到Xcode7之后,发现突然多了很多warning
之前写的
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:nil];// Null passed to a callee that requires a non-null argument
注意nil参数,为了兼容swift,所以Xcode里设置了nonnull/nullable
不嫌麻烦的话可以重写这个方法:
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@””];
嫌烦的朋友可以直接加上这段
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnonnull"
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:nil]; #pragma clang diagnostic pop
==================================================================================
// 让编译器忽略烦人的内存泄漏警告(慎用)
#pragma clang diagnostic push
#pragma clang diagnostic ignored “-Warc-performSelector-leaks”
data = [[NSData class] performSelector:dataWithUncompressedContentsOfFile withObject:bundlePath];
#pragma clang diagnostic pop
// 见不见为净的不兼容指针
#pragma clang diagnostic push
#pragma clang diagnostic ignored “-Wincompatible-pointer-types”
#pragma clang diagnostic pop
// 没有使用过的变量再也不提示了
#pragma clang diagnostic push
#pragma clang diagnostic ignored “-Wunused-variable”
NSString *strParams = @””;
#pragma clang diagnostic pop
http://clang.llvm.org/docs/UsersManual.html#diagnostics_pragmas