2010-12-07 3 views
0

나는 Backgroundmusic.h 파일로라는 이름의 클래스는어떻게 다른 클래스에 정의 된 메소드를 호출

#import "UIKit/UIKit.h" 
#import "AVFoundation/AVFoundation.h" 
#import "AudioToolbox/AudioToolbox.h" 

@interface Backgroundmusic : NSObject{ 
} 

-(void)playBgmusic:(BOOL) issoundon; 

@end 

Backgroundmusic.m는 내가 뭘하려고 설정되어 기본적으로

-(void)playBgmusic:(BOOL)issoundon { 
    //AVAudioPlayer *myExampleSound; //this variable can be named differently 

if (issoundon==TRUE) { 

     NSString *path =[[NSBundle mainBundle] pathForResource:"bg" ofType:@"wav"]; 
     SystemSoundID soundID; 
     AudioServicesCreateSystemSoundID((CFURLRef) [NSURL fileURLWithPath:path] 
            ,&soundID); 
     AudioServicesPlaySystemSound(soundID); 
    } 
    else { 
     NSString *path =[[NSBundle mainBundle] pathForResource:nil ofType:@"wav"]; 
     SystemSoundID soundID; 
     AudioServicesCreateSystemSoundID((CFURLRef) [NSURL fileURLWithPath:path] 
            ,&soundID); 
     AudioServicesPlaySystemSound(soundID); 
    } 
} 

입니다했다 시작시에 내 앱에 배경 음악을 보내고 사용자가 중간에서 멈추게 할 수 있습니다. 내 xAppdelegate.mi에서이 기능을 호출 한 적이 있으므로

- (void)applicationDidFinishLaunching:(UIApplication *)application {  
    Backgroundmusic *bgm=[[Backgroundmusic alloc] init]; 
    [bgm playBgmusic:TRUE]; 
} 

하지만이 시점에서 내 앱이 종료되면 누군가 내게이 문제를 뭐라고 말할 수 있습니까 ???

+1

실제로'# import'-Ed'BackgroundMusic.h'을 사용 했습니까? –

+0

앱 종료시 표시되는 오류 메시지는 무엇입니까? 'EXC_BAD_ACCESS'? 'NSException'? 다른 것? –

답변

0

오류 메시지는 무엇입니까? 응용 프로그램이 종료되면 gdb 창에서 확인할 수 있습니다. 적절한 오류 메시지가 표시됩니다. 이 스레드에 오류 메시지를 게시하십시오.

+0

사실 나는 "디버깅중인 프로그램이 실행되고 있지 않습니다." 오랜 시간에서하지만 mp 애플 리케이션 device.But이 오류로 인해 디버거를 사용할 수 없습니다 노력하고 있습니다. 그래서 미안 내가 말할 수 없어 오류. –

관련 문제