【问题标题】:NSLocalizedStringWithDefaultValue - Format string is not a string literalNSLocalizedStringWithDefaultValue - 格式字符串不是字符串文字
【发布时间】:2018-09-15 01:09:38
【问题描述】:

我启用了一些特定的编译器标志,现在我的所有本地化都收到以下警告:

NSString *localizedString = NSLocalizedStringWithDefaultValue(@"*Meta.likeCount", nil, [NSBundle mainBundle], @"%lu", @"%lu is the like count");

self.likeCountLabel.text = [NSString stringWithFormat:localizedString, image.likeCount];

格式字符串不是字符串文字

我查找了几个类似的问题,但无法修复编译器错误。

【问题讨论】:

    标签: ios objective-c localization nsstring


    【解决方案1】:

    你好像打开了-Wformat-nonliteral

    如果它妨碍您,请将其关闭,或根据具体情况进行处理。见Correcting “format string is not a string literal” warning

    【讨论】:

    • 是的,这是故意的。我想包含更多编译器标志。
    猜你喜欢
    • 2012-03-26
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多