忽略#pragma的警告

时间:2015-04-23 08:50:44

标签: ios objective-c xcode 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"

1 个答案:

答案 0 :(得分:1)

-Wall不包含所有警告,它仅包含一组指定的警告。使用-Weverything可能会更成功,但是,始终最好找到要阻止的确切警告。在这种情况下-Wformat-nonliteral