如何在下面的代码中禁用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"
答案 0 :(得分:1)
-Wall
不包含所有警告,它仅包含一组指定的警告。使用-Weverything
可能会更成功,但是,始终最好找到要阻止的确切警告。在这种情况下-Wformat-nonliteral
。