【问题标题】:unable to build in Xcode 4.3.2 because getting the clang failed with exit code 254无法在 Xcode 4.3.2 中构建,因为退出代码 254 导致 clang 失败
【发布时间】:2012-04-18 01:05:50
【问题描述】:

我只是突然开始在 LLVM 3.1 编译器中遇到以下错误。请帮助如何调试它。请让我知道我是否应该为此发布更多信息。

命令 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 失败,退出代码为 254

【问题讨论】:

  • 可能是编译器错误 - stackoverflow.com/questions/9335012/….
  • 无法确定这一点,因为相同的代码直到昨天才有效,几分钟前才开始给我错误。我没有对其进行任何更改。一般来说,导致此错误的原因可能是什么
  • 这是完整的错误描述。检查您的框架是否正确链接。
  • 能够解决它。我在该方法不存在的对象上调用方法。但不知道为什么构建给出了 254 的错误,而不是该方法不存在。我将其更改为正确的名称并且它有效:-) 该错误非常具有误导性。

标签: ios


【解决方案1】:

在我搞砸了一些字符串处理后,我最终得到了同样的错误: 破碎:

// 7.30.12 Unspaced/Original - remove windows \r, replace with " " (space) - let textbox wrap
// [mutTempString setstring: [mutTempString stringByReplacingOccurrencesOfString:@"\r" withString:" "]];
// 7.30.12 - Need some 'padding' at the top of the textbox (I copied and pasted above and generated the !code 254 error)
[mutTempString setString:[NSString stringWithFormat:@"\n\n%@", [mutTempString setString:[mutTempString stringByReplacingOccurrencesOfString:@"\r" withString:" "]]]];

我摆脱了 'nested' 或 'deep-inline' [mutable setstring...] 并且一切都恢复正常了: 固定:

// 7.30.12 - Need some 'padding' at the top of the textbox (remove the 'inside' setstring)
[mutTempString setString:[NSString stringWithFormat:@"\n\n%@", [mutTempString stringByReplacingOccurrencesOfString:@"\r" withString:" "]]];

【讨论】:

    【解决方案2】:

    我也通过调用不在 Objective-C 中的方法得到了这个错误

    我正在使用:

    NSString *redirectUrl = [NSString stringWithFormat:@"%@%@", @"http", **components[2]**];
    

    并意识到这是一种访问数组值的 PHP 方式。

    所以我把它改成了这样:

    NSString *redirectUrl = [NSString stringWithFormat:@"%@%@", @"http", [components objectAtIndex:2]];
    

    现在一切正常:D

    【讨论】:

      【解决方案3】:

      好的,所以我自己调试了这个问题,因为这是一个没有答案的帖子,我想我应该解释一下我是如何解决它的。

      在我的情况下,错误是由 试图获取没有分配标签的 UIImageView 的标签引起的。

      首先我尝试了明显的解决方案: - 退出 xcode 和模拟器,重新打开,尝试再次构建 - 重新启动计算机,重新打开,尝试再次构建 - 执行清洁(cmd + shift + K)。 这些都不起作用,所以我回顾了我在代码中所做的看似无辜的更改。

      这导致了崩溃:

      if (!([[buttonsArray objectAtIndex:i] tag] > 299 )) {
         //NSLog(@"removed [buttonsArray removeObjectAtIndex:i]:%@",[buttonsArray removeObjectAtIndex:i]);
         [buttonsArray removeObjectAtIndex:i];
      }
      

      这没有:

      if ([[buttonsArray objectAtIndex:i] class] != [UIButton class] ) {
         //NSLog(@"removed [buttonsArray removeObjectAtIndex:i]:%@",[buttonsArray removeObjectAtIndex:i]);
         [buttonsArray removeObjectAtIndex:i];
      }
      

      我的数组包含 3 个 UIButton,每个都有大于 299 的标签和一个 UIImageView。 Array 的 NSLog 显示:

      2012-05-10 01:46:14.555 My Application[542:fe03] buttonsArray:(
          "<UIImageView: 0x6b7f940; frame = (0 0; 252 272); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6b71dc0>>",
          "<UIButton: 0x6b7ae70; frame = (8 8; 53 53); opaque = NO; tag = 300; layer = <CALayer: 0x6b6fb70>>",
          "<UIButton: 0x6b8be00; frame = (69 8; 53 53); opaque = NO; tag = 301; layer = <CALayer: 0x6b8bd70>>",
          "<UIButton: 0x6b8c1b0; frame = (130 8; 53 53); opaque = NO; tag = 302; layer = <CALayer: 0x6b8c140>>"
      )
      

      所以问题是 UIImageView 没有分配标签。当我试图将其符号与 299 进行比较时,编译器抛出了这个错误。我认为这没问题(我在某处读到未分配标签默认为 0)但我猜不是!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-24
        相关资源
        最近更新 更多