2012-08-04 4 views
0

내 앱에서 mp3를 재생하려고하는데 많은 연구 끝에 상대 경로 지정 또는 절대 경로 지정을 사용하여 음악을 재생하는 방법을 파악할 수 없습니다. .음악 오류 및 상대 경로 재생

//set music 
NSError *error; 
if (songChosen == 0) 
{ 
    soundPath = @"/Users/aeubanks/Desktop/XCode Stuff/Apps/Game-Storyboard/Game-Storyboard/Amalgamation.mp3"; 
} 
else if (songChosen == 1) 
{ 
    soundPath = @"/Users/aeubanks/Desktop/XCode Stuff/Apps/Game-Storyboard/Game-Storyboard/BUTTERFLY.mp3"; 
} 
audio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundPath] error:&error]; 
if([[NSFileManager defaultManager] fileExistsAtPath:soundPath] == NO) 
{ 
    NSLog(@"No File"); 
} 

else 
{ 
    NSLog(@"Yes File"); 
} 

if(error != nil) 
{ 
    NSLog(@"%@", error); 
} 
[audio prepareToPlay]; 

NSLog이가 (준비) 말한다 :

2012-08-04 15 : 52 : 02.415 게임 - 스토리 보드 [8430 : 10703]를 예

파일을이 내가 가진 무엇

2012-08-04 15 : 52 : 02.473 게임 스토리 보드 [8430 : 12303]/시스템/라이브러리/확장 프로그램/오디오 IPCDriver.kext/콘텐츠/오디오/오디오 IPCPlugIn.bundle/내용/시스템/라이브러리/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262) : 기호를 찾을 수 없음 : __ CFO bjCIsCollectable 참조 : /System/Library/Frameworks/Security.framework/Versions/A/Security /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1에서 예상됩니다. sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation in /System/Library/Frameworks/Security.framework/Versions/A/Security 2012-08-04 15 : 52 : 02.486 게임 스토리 보드 [8430 : 12303] /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn : dlopen (/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/) MacOS/AudioIPCPlugIn, 262) : 기호를 찾을 수 없음 : _ _CFObjCIsCollectable 참조 : /System/Library/Frameworks/Security.framework/Versions/A/Security /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation in/System/Library/Frameworks /Security.framework/Versions/A/Security 2012-08-04 15 : 52 : 02.525 Game-Storyboard [8430 : 12303] 오류로드 /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/ 목차/MacOS/AppleHDAHALPlugIn : dlopen (/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262) : 기호를 찾을 수 없음 : __ CFObjCIsCollectable 참조 :/System/라이브러리/프레임 워크/보안. 프레임 워크/버전/A/보안 예상 경로 : /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPh oneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundationin /System/Library/Frameworks/Security.framework/Versions/A/Security 2012-08-04 15 : 52 : 02.546 게임 스토리 보드 [ 8430 : 12303] /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn : dlopen (/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn)을로드하는 중 오류가 발생했습니다. 번들/내용/맥 OS/AppleHDAHALPlugIn, 262) : 기호를 찾을 수 없습니다 _ _CFObjCIsCollectable 에서 참조 : 예상 /System/Library/Frameworks/Security.framework/Versions/A/Security : /Applications/Xcode.app/Contents /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation in/System/Library/F rameworks/Security.framework/Versions/A/Security 2012-08-04 15 : 52 : 02.570 Game-Storyboard [8430 : 12303] /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle을로드하는 중 오류가 발생했습니다./Contents/MacOS/AppleHDAHALPlugIn : dlopen (/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262) : 기호를 찾을 수 없음 : __ CFObjCIsCollectable 참조 :/System /Library/Frameworks/Security.framework/Versions/A/Security /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator에서 예상됩니다.플랫폼/개발자/SDKs/iPhoneSimulator5.1.sdk/시스템/라이브러리/프레임 워크/CoreFoundation.framework/CoreFoundation in /System/Library/Frameworks/Security.framework/Versions/A/Security 2012-08-04 15:52 : 02.582 Game-Storyboard [8430 : 12303] /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn : dlopen (/System/Library/Extensions/AppleHDA.kext/)을로드하는 중 오류가 발생했습니다. 내용/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262) : 기호를 찾을 수 없음 : _ _CFObjCIsCollectable 참조 : /System/Library/Frameworks/Security.framework/Versions/A/Security 예상 내용 :/응용 프로그램 /Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation/System/Library/Frameworks/Security.framework/Versions/A/Security

에서나는 또한 @ "BUTTERFLY.mp3"/ @ "Amalgamation.mp3"뿐만 아니라 @ "게임에 soundPath 설정 시도 -Storyboard/BUTTERFLY.mp3 "/ @"게임 - 스토리 보드/Amalgamation.mp3 "을, 그리고이 얻을 :

2012-08-04 15 : 58 : 55.763 게임 - 스토리 보드 [8470 : 10703] 없음 파일

2012-08-04 15:58:55.767 Game-Storyboard [8470 : 10703] 오류 도메인 = NSOSStatusErrorDomain 코드 = -43 "작업을 완료 할 수 없습니다. (. OSStatus 오류 -43) "나는이 모든 것이 무엇을 의미하는지 전혀 모르는

, 그래서 나는이 문제를 해결하기 위해 어떤 도움을 주셔서 감사합니다 것

답변

0

를 나는 이런 식으로 뭔가를 (여기에 조각이야) 할 것 :.

if (songChosen == 0) 
{ 
    NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"Amalgamation" ofType:@"mp3"] 
    NSURL *soundFileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath]; 
    NSError *error; 
    AVAudioPlayer *aPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:&error]; 
} 

나는 또한

+0

이 중 하나를 작동하지 않습니다. 번들에 독서 좋을 것 내가 같은 오류가 발생합니다. – aeubanks

+1

을 당신이 시뮬레이터에서 작업하는 것 같은데요? 알려진 버그가 있습니다 그 오류와 함께 - 주요 질문은 소리가 실제로 p 어쨌든 낳는다. –