1

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

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

4

3 回答 3

2

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

// 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:" "]]];
于 2012-07-30T17:18:10.463 回答
1

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

我正在使用:

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

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

所以我把它改成这样:

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

现在它工作正常:D

于 2012-08-30T09:23:10.940 回答
0

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

在我的情况下,错误是由于试图获取没有分配标签的 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。数组的 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),但我猜不是!

于 2012-05-10T05:51:32.313 回答