2011-01-07 5 views
1

저는 아이폰 프로그램에서 새로운데 작은 애니메이션 프로그램을 썼습니다. 오디오 용 audiotoolbox 프레임을 사용했는데 작동 중이었습니다. 하지만 사운드 파일을 변경할 때. (리소스 및 폴더에서 exfile을 삭제하고 동일한 이름, 동일한 경로를 가진 다른 파일을 추가하십시오)Audio Toolbox 사운드 변경 문제

변경 소리가 작동하지 않습니다.

또한 전 파일로 사운드 파일을 변경했습니다.하지만 이전 파일도 작동하지 않습니다.

(모두 .wav 유형 임) 여기에 코드를 쓸 수 있습니다. 도움을 청합니다.

답변

0

코드 재 작성을 시도해 보셨습니까? 대신 AVFoundation Framework를 사용해 볼 수도 있습니다.

.H

#import <UIKit/UIKit.h> 
#import <AVFoundation/AVFoundation.h> 

@interface AudioPlayerViewController : UIViewController { 
    AVAudioPlayer *audioPlayer; 
} 

@end 

하는 .m

- (void)viewDidLoad { 
    [super viewDidLoad]; 

    NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/audiofile.mp3", [[NSBundle mainBundle] resourcePath]]]; 

    NSError *error; 
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; 

    if (audioPlayer == nil) 
     NSLog([error description]); 
    else 
     [audioPlayer play]; 

}