尝试构建应用程序时出现LLVM编译器4.0错误

时间:2012-08-10 01:53:10

标签: objective-c ios

  

致命错误:检测到UTF-16(LE)字节顺序标记   '/ Users / Kylegreenlaw / Downloads / Sound + / Sound + / ViewController.m',但是   不支持编码1生成错误。

我刚才在.m文件中添加了这个

-(IBAction)buttonPressedWithSound:(id)sender {

    int randomSoundNumber = arc4random() % 4; //random number from 0 to 3

    NSLog(@"random NR = %i", randomSoundNumber);

    NSString *effectTitle;

    switch (randomSoundNumber) {
        case 0:
            effectTitle = @"Come at me BRO!";
            break;
        case 1:
            effectTitle = @"sound2";
            break;
        case 2:
            effectTitle = @"sound3";
            break;
        case 3:
            effectTitle = @"sound4";
            break;

        default:
            break;
    }

    SystemSoundID soundID;

    NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle 
                                                          ofType:@"mp3"];
    NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];

    AudioServicesCreateSystemSoundID ((CFURLRef)soundUrl, &soundID);
    AudioServicesPlaySystemSound(soundID);
}

然后我去运行它,但日志打印出这个错误。发生了什么,我该如何解决?

2 个答案:

答案 0 :(得分:4)

删除方法中的代码,然后重新编译 - 如果错误消失,则在复制代码的某处会出现错误的字符。逐行删除,直到找到带有错误字符的行,然后重新输入。

答案 1 :(得分:0)

确保您已导入所有必需的文件,您可能错过了导入核心音频或错过了将其链接到项目。