2012-08-10 40 views
0

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.LLVM編譯器試圖構建應用程序

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

時4.0錯誤然後我去運行它,但打印此錯誤日誌。發生了什麼,我該如何解決?

回答

0

確保您已導入所有必需的文件,您可能錯過了導入核心音頻或錯過了將其鏈接到項目。

4

刪除方法中的代碼,並重新編譯 - 如果錯誤消失,則表明錯誤的字符位於複製代碼的某處。逐行刪除,直到找到包含不良字符的行,然後重新輸入。

相關問題