Hey
I'm kind of new to Xcode but I've come a long way on my first app. Adding sound has been a real mess though.
The first code I used caused the app to lag whenever a sound played and gave a lot of warnings. The other code didn't work at all. And now, when I tried the third option, i accidentally deleted all the frameworks.
I copied over all the frameworks from a new project into mine, but don't know if you can do it like that. The code I'm using right now also wants me to get the Audiotoolbox.framework, which I now have but it still doesn't seem to work.
The code I'm using for a playing a sound is:
I've set the right file name to the imported sound.
The 2 errors I'm getting along with 1 warning:
As I said, I'm kinda new to Xcode so these errors leave me clueless. Please help!
I'm kind of new to Xcode but I've come a long way on my first app. Adding sound has been a real mess though.
The first code I used caused the app to lag whenever a sound played and gave a lot of warnings. The other code didn't work at all. And now, when I tried the third option, i accidentally deleted all the frameworks.
I copied over all the frameworks from a new project into mine, but don't know if you can do it like that. The code I'm using right now also wants me to get the Audiotoolbox.framework, which I now have but it still doesn't seem to work.
The code I'm using for a playing a sound is:
Code:
SystemSoundID ssid;
NSString *paths=[[NSBundle mainBundle]resourcePath];
NSString *audioFile=[paths stringByAppendingPathComponent :@"yoursound.wav"];
NSURL *audioURL=[NSURL fileURLWithPath:audioFile isDirectory:NO];
OSStatus error=AudioServicesCreateSyste mSoundID((CFURLRef)audioURL, &ssid);
if(error){NSLog(@"Audio error");}
else{AudioServicesPlaySystemSo und(ssid);}
I've set the right file name to the imported sound.
The 2 errors I'm getting along with 1 warning:
Code:
(Warning)
Link /Users/mymacsname/Documents/Magnetman/build/Debug-iphonesimulator/SimpleGame.app/SimpleGame
In /Users/mymacsname/Documents/Magnetman/AudioToolbox.framework/AudioToolbox, missing required architecture i386 in file
(Error)
"_AudioServiesPlaySystemSound", referenced from:
-[SimpleGameViewController touchesBegan:withEvent:] in SimplegameViewController.o
(Error)
"_AudioServicesCreateSystemSoundID", referenced from:
-[SimpleGameViewController touchesBegan:withEvent:] in SimpleGameViewController.o
Symbol(s) not found
Collect2: Id returned 1 exit status
As I said, I'm kinda new to Xcode so these errors leave me clueless. Please help!