如何在下面的代码中禁用 XCode 警告 Format string is not a string literal
?
- (void)testRemovingOldCode {
NSMutableDictionary *oldRequestDict = [[[OldConfigManager sharedManager] feedURLForKey:kStatItemFixtureDetailURLKey] mutableCopy];
NSString *urlString = [NSString stringWithFormat:oldRequestDict[kURLKey], //Warning: "Format string is not a string literal"
@"Param1",
@"Param2",
@"Param3"];
}
我已经累了(没有成功):
#pragma GCC diagnostic ignored "-Wall"
#pragma clang diagnostic ignored "-Wall"
最佳答案
-Wall
不包含所有警告,它仅包含一组指定的警告。使用 -Weverything
可能会更成功,但是,找到您想要阻止的确切警告始终是最好的选择。在本例中-Wformat-nonliteral
。
关于ios - 忽略 #pragma 发出的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29818302/