나는 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];
}
하지만이 시점에서 내 앱이 종료되면 누군가 내게이 문제를 뭐라고 말할 수 있습니까 ???
실제로'# import'-Ed'BackgroundMusic.h'을 사용 했습니까? –
앱 종료시 표시되는 오류 메시지는 무엇입니까? 'EXC_BAD_ACCESS'? 'NSException'? 다른 것? –