2009-03-25 20 views
6

Bazı wav dosyalarını oynatmaya çalıştığım basit bir Roulett uygulamasında aşağıdaki hatayı alıyorum. Ben hiçbir uyarı bayrakları kodunda gelip çünkü hata ne anlama geldiğini emin değilim, ben burada Objektif C'deki Ses Kutusu Kutusuna Referans Hatası

ithal ettik hatadır:

Undefined symbols:
"_AudioServicesCreateSystemSoundID", referenced from: -[CustomPickerViewController playWinSound] in CustomPickerViewController.o -[CustomPickerViewController spin:] in CustomPickerViewController.o "_AudioServicesPlaySystemSound", referenced from: -[CustomPickerViewController playWinSound] in CustomPickerViewController.o -[CustomPickerViewController spin:] in CustomPickerViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status
"_AudioServicesCreateSystemSoundID", referenced from: -[CustomPickerViewController playWinSound] in CustomPickerViewController.o -[CustomPickerViewController spin:] in CustomPickerViewController.o "_AudioServicesPlaySystemSound", referenced from: -[CustomPickerViewController playWinSound] in CustomPickerViewController.o -[CustomPickerViewController spin:] in CustomPickerViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status

Ve burada kodudur:

#import "CustomPickerViewController.h" 
#import <AudioToolbox/AudioToolbox.h> 

@implementation CustomPickerViewController 
@synthesize picker; 
@synthesize winLabel; 
@synthesize column1; 
@synthesize column2; 
@synthesize column3; 
@synthesize column4; 
@synthesize column5; 
@synthesize button; 

- (void)showButton 
{ 
    button.hidden = NO; 
} 

-(void)playWinSound 
{ 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"win" ofType:@"wav"]; 
    SystemSoundID soundID; 
    AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID); 
    AudioServicesPlaySystemSound (soundID);  
    winLabel.text = @"WIN!"; 
    [self performSelector:@selector(showButton) withObject:nil afterDelay:1.5]; 
} 



-(IBAction)spin:(id)sender 
{ 
    BOOL win = NO; 
    int numInRow = 1; 
    int lastVal = -1; 
    for (int i = 0; i < 5; i++) 
    { 
     int newValue =random() % [self.column1 count]; 

     if (newValue == lastVal) 
      numInRow++; 
     else 
      numInRow = 1; 

     lastVal = newValue; 
     [picker selectRow:newValue inComponent:i animated: YES]; 
     [picker reloadComponent:i]; 
     if (numInRow >= 3) 
      win = YES; 
    } 

    button.hidden = YES; 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"crunch"ofType:@"wav"]; 
    SystemSoundID soundID; 
    AudioServicesCreateSystemSoundID((CFURLRef) [NSURL fileURLWithPath:path], &soundID); 
    AudioServicesPlaySystemSound(soundID); 

    if (win) 
     [self performSelector:@selector(playWinSound) withObject: nil afterDelay: .5]; 
    else 
     [self performSelector:@selector(showButton) withObject: nil afterDelay: .5]; 

    winLabel.text = @""; 
} 

cevap

25

Bulunamadı. Gerçekleştirdim XCode içinde Framework AudioToolbox.Framework ithal değil. :)