0
如何在下面的代码中禁用XCode警告Format string is not a string literal
?忽略#pragma的警告
- (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"
理想情况下,您应该只使用字符串文字作为格式字符串。你为什么试图缄默警告?修复代码! – Sulthan
这不是我的代码。我正在修复旧代码并进行单元测试,以确保旧代码和新代码的行为方式相同。 – Szu
你试过用'-Wformat-nonliteral'来封锁它吗? – Sulthan