忽略 #pragma 发出的警告

Ignoring warning by #pragma

如何在下面的代码中禁用 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.