gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 19:16:18 24 4
gpt4 key购买 nike

fatal error: UTF-16 (LE) byte order mark detected in '/Users/Kylegreenlaw/Downloads/Sound +/Sound +/ViewController.m', but encoding is not supported 1 error generated.

我只是在 .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);
}

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

最佳答案

删除方法中的所有代码,然后再次编译 - 如果错误消失,则说明复制代码的某个地方有问题。逐行删除,直到找到错误字符的行,然后重新输入。

关于objective-c - 尝试构建应用程序时出现 LLVM 编译器 4.0 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11894445/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com