2014-07-22 3 views
0

iOS 시스템 및 iOS 앱에 대한 질문이 있습니다.iOS 앱의 음악 설정

iPhone의 음악을 재생할 때 일부 앱에서 음악을 열 때 음악이 중지됩니다.

예 : 라인 레인저. 일부 앱은 음악을 허용합니다.

Facebook과 같이 계속해서 재생됩니다.

앱을 만든 경우 어떻게 설정해야하나요?

감사합니다.

+0

가능한 중복 [응용 프로그램이 실행 시작할 때 아이폰 OS가 음악을 중지하지 않는 방법 (http://stackoverflow.com/questions/18762544/ios- 시작 방법 - 시작 - 실행 - 응용 프로그램 시작) –

+0

도움을 주셔서 감사합니다 이제 상대 코드를 연구 중입니다. – Atimis

답변

2

사용중인 AVAudioSession에 카테고리를 설정할 수 있습니다.

/* set session category */ 
- (BOOL)setCategory:(NSString *)category error:(NSError **)outError; 

가능한 범주는 다음과 같습니다의

#pragma mark -- Values for the category property -- 

/* Use this category for background sounds such as rain, car engine noise, etc. Mixes with other music. */ 
AVF_EXPORT NSString *const AVAudioSessionCategoryAmbient; 

/* Use this category for background sounds. Other music will stop playing. */ 
AVF_EXPORT NSString *const AVAudioSessionCategorySoloAmbient; 

/* Use this category for music tracks.*/ 
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayback; 

/* Use this category when recording audio. */ 
AVF_EXPORT NSString *const AVAudioSessionCategoryRecord; 

/* Use this category when recording and playing back audio. */ 
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayAndRecord; 

/* Use this category when using a hardware codec or signal processor while not playing or recording audio. */ 
AVF_EXPORT NSString *const AVAudioSessionCategoryAudioProcessing; 
+0

답변 해 주셔서 감사합니다. 나는 이해했다. – Atimis