【问题标题】:semantic issue Unused Parameter 'format' warnings xcode 4.6语义问题未使用的参数“格式”警告xcode 4.6
【发布时间】:2013-02-26 14:00:42
【问题描述】:

在 .m 文件中,我收到此警告不是错误

语义问题未使用的参数“格式”

在 xcode4.6 中打开此 .m 文件后,将其作为未使用的参数获取

+ (ParsedResult *)parsedResultForString:(NSString *)s
                                 format:(BarcodeFormat)format 

【问题讨论】:

  • mmm..更多细节请...
  • 这个警告有什么问题我无法理解
  • 请回答这个问题

标签: xcode4.6


【解决方案1】:

此警告意味着参数format 从未在您的函数中使用。 要消除该警告,您可以执行以下操作之一。

a) 使用特殊的#pragma 来抑制某些函数中的警告,只需将它放在你的函数实现下面,即:

+ (ParsedResult *)parsedResultForString:(NSString *)s
                             format:(BarcodeFormat)format
{
    #pragma unused (format)
    // ... your code here ...

b) 在项目中全局关闭此警告。转到您的项目设置或目标设置=> Build Settings => Apple LLVM Compiler 4.2 - Warnings - All languages => Unused Parameters,将其设置为No

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-03
    • 2017-10-24
    • 2013-07-07
    • 1970-01-01
    • 1970-01-01
    • 2012-10-25
    • 2012-09-02
    • 2011-08-20
    相关资源
    最近更新 更多