1
오디오가 이미 재생 중인지 여부에 따라 AVAudioSession 범주를 설정하려고하고 있으며 AVAudioSession 용 Apple Dev Docs를 읽은 후이 솔루션을 직접 사용해 보았습니다. 달성하기 위해 노력했다 :AudioSessionGetProperty 정의되지 않은 기호 i386
UInt32 otherAudioIsPlaying; // 1
UInt32 propertySize = sizeof (otherAudioIsPlaying);
AudioSessionGetProperty ( // 2
kAudioSessionProperty_OtherAudioIsPlaying,
&propertySize,
&otherAudioIsPlaying
);
if (otherAudioIsPlaying) { // 3
[[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryAmbient
error: nil];
} else {
[[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategorySoloAmbient
error: nil];
}
모든 것이 제대로 컴파일하지만 내가 구축하고 응용 프로그램을 실행하려고 할 때, 나는 AudioSessionGetProperty
에 해당하는 마하 - O 링커 오류가 발생합니다.
Undefined symbols for architecture i386:
"_AudioSessionGetProperty", referenced from:
+[AppDelegate setAudioSession] in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
나는 (코드가 실행중인) 내 AppDelegate에로
AVFoundation/AVFoundation.h
파일을 가져옵니다.
또한을 AVFoundation 프레임 워크를 프로젝트 바이너리로 가져 왔습니다. 이 방법에 필요한 다른 프레임 워크가 누락 되었습니까? 이 오류가 발생하는 이유는 무엇입니까? 이 문제가 될 수 있습니다 다른 사람들을위한
프레임 워크를 가져 오지 않았을 수 있습니다. "Build Phases-> Link Binary With Libraries"메뉴가없는 경우 추가하십시오 (AVFoundation.framework) –
AVFoundation.framework가 "라이브러리와 이진 파일 링크 ". – David
hmmm 이상한데, AVAudioSession.h를 가져 와서 고치 죠? –