Szu
Szu

Reputation: 2252

Ignoring warning by #pragma

How can I disable XCode warning Format string is not a string literal in the code below?

- (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"];
}

I already tired (without success):

#pragma GCC diagnostic ignored "-Wall"
#pragma clang diagnostic ignored "-Wall"

Upvotes: 0

Views: 247

Answers (1)

Sulthan
Sulthan

Reputation: 130102

-Wall doesn't include all warnings, it includes only a specified set of warnings. You might be more successful with -Weverything, however, it's always the best to find the exact warning you want to block. In this case -Wformat-nonliteral.

Upvotes: 1

Related Questions